Design Cookbook: Using Software Packages for Engineering Calculations

Cookbook Index


It is very common for students to have trouble when completing their engineering calculations.  Professor Sachs at MIT has written some excellent guidelines for doing calculations.  READ THEM AND TAKE THEM TO HEART.  This document is intended to show you some examples of how to clearly present your work in the various software packages.  It also points out the pro's, con's, and pitfalls of each.

Why use a software package when doing calculations?

  1. TO MAKE YOUR TASK EASIER!
  2. Suffer through the pain of working out the math for a particular problem once.  Save the file and you can use it as a resource later.
  3. If you do make a mistake, you can correct the single mistake and the rest of the numbers afterward will correct themselves.
  4. You can compare several designs quickly (why waist your time plugging and chugging through a much of math.
  5. And don't forget that matrices and linear algebra are your friends when solving systems of linear independent equations.

There are three basic packages available at MIT for doing basic engineering calculations.  They are:

MathCAD:

It is the easiest to read, complicated equations can be typed in very quickly, and it keeps track of units for you.  These three features make it very easy to write, catch errors, and grade.   Very easy to enter and solve linear systems.

Microsoft Excel:

This is good for displaying multiple designs side by side.  How ever if you use it in this manner you can not take advantage of the ability to give the cells meaningful names.  Grading or reviewing a design done in excel is difficult because you can't see the equations that were used.  So, you have to have additional paperwork to show the equations used for each cellt.  Very tedious to enter and solve linear systems.

MATLAB:

Good for doing big numeric analysis. Code can be difficult to read, understand, and grade if it is not commented well, and variables are not given meaningful names.  Very nice plotting features.  Good at solving linear systems, but entering the matrices can be a pain.

Examples Problems:

Below are some example problems showing a good method of presenting your work in the various software packages.  What you hand in should be very clear and easy to follow. To do well on your calculations keep the following in mind.  Have a clear idea of what you know and what you are looking for.  State these clearly at the top of your calculation.

Example Problem 1:

This is Example 4.2 from A. F. Mill's Basic Heat and Mass Transfer (BHMT).

We are interested in finding the coefficient of convection for an air stream traveling between two plates.  The plates have a temperature of 600 K and the average bulk temperature of the air is 400 K.  The air is flowing at 0.11 kg/s, and the channel between the plates is 1 cm wide and 0.5 meters high.  The channel is 0.8 meters long.  The entrance has a 90 degree edge.

The Solution in MathCAD:

MathCAD is far and away my favorite package (of the three above) for heat transfer problems.  This is due to the amount of unit checking that is needed and the complexity of the equations that are typically involved.  If I wanted to test a different plate size and the values were given in inches, I could just enter the new values for w, h, and l (in inches), and keep the fluid parameters in metric units (much more convenient to look up in metric) and it would calculate hc correctly.

NOTE: If you are using units in MathCAD make sure you don't give variables the same name as a unit that you are using. For example if you are using the unit of meters (m) then do not also denote the mass of an object with the variable m.  This will really screw things up.

Download this MathCAD file (heatxfer.mcd)

heatxfer_mcad.JPG (112489 bytes)

The Solution in Excel:

The following is an example of a well laid out Excel spread sheet.   It produces the exact same solution as the MathCAD file above, however...

First I do the calculation out by hand.  This ensures that I understand the problem, and that I am not simply the plugging things blindly into cells.  It also give an easy way to check the spread sheet.  Given the same inputs I should get the same result as the hand calculation.  Doing the calculations by hand first, is much less important in MathCAD because units are tracked automatically and it is easy to read the equations.

handcalcs1.JPG (84826 bytes)

handcalcs2.JPG (27569 bytes)

Download this Excel File (heatxfer.xls)

heatxfer_excell1.JPG (129345 bytes)

The Solution in MATLAB:

It is almost always worth your time to write an m-file when doing a calculation in MATLAB rather then doing it from the command line. Below is the m file for the above problem.  Notice the amount of commenting.  This is important for the grader to follow what you did AND for you to understand it when you look at the file again after not having not thought about it for several weeks or months.  Much like an Excel spreadsheet, a lot of mistakes and agony can be saved if you solve the problem first by hand.  The same hand calculations used in the Excel example were used here.

Download this MatLAB file (heatxfer.m)

heatxfer_mlab.jpg (130108 bytes)

heatxfer_mlab2.jpg (23706 bytes)