Add the Unix commands and symbols in Table 2. to your repertoire. The emphasis in this assignment will be on the use of Matlab to solve sets of algebraic equations. If the equations are linear, they may be solved with very little effort in Matlab. A single non-linear equation may also be solved numerically using various Matlab tools. The tools include:
Laboratory Problems
These problems may be completed with help from any of your fellow students (as well as the instructor). You may not copy anyone else's work, but you can get other users to give you suggestions and point out mistakes that should be corrected.
1) The following vector gives volumes that have been measured in various units (indicated in parentheses.)
55.73 (cubic inches), 91.7 (cubic feet), 0.02 (cubic miles), 17830 (cubic centimeters).
Use Matlab to convert all to areas in cubic meters. Begin with a vector of conversion factors: inches-to-m, etc., constructed from the identities given below.
one meter = 3.28084 feet = 100 centimeters one mile = 5280 feet one foot = 12 inchesShow all steps needed. Start with a vector that tells how to convert from each of the following units: in., ft., mi., cm. to meters. Then use vector operations to finish the job.
2) A chemical plant produces X,Y, and Z in varying proportions. The
first week the output was 80 per-cent X, 15 per-cent Y, and the rest Z.
The second week it was 55 per-cent X,
35 per-cent Y, and the rest Z. Total production was 4000 lbs the first
week and 4800 lbs the second.
The first week, X sold for $20/lb., Y sold for $28/lb., and Z for $45.32/lb. The second week, X sold for $23.20, Y for $30.50, and Z for $42.50. Construct 2 tables showing production for both weeks by product, and income for each week by product. Do this by putting all of the production data in a matrix and the selling price data in another matrix. Then show how these two matrices can be used to produce the required tables.
3) Learn how to make simple two dimensional plots with the fplot command. Example 15.3 in the text: Systematic Methods of Chemical Process Design considers the choice of flows to two reactors operated in parallel. The total product rate is fixed, but the amount of flow to each of the reactors may be set as any positive number. If x is the flow to the first reactor, the total cost of the reactors is determeined by:
C = 5.5*x0.6 + 4.0*((10 - 0.8*x)/0.67)0.6 + 5*(x + (10 - 0.8*x)/0.67)Two topics you may need to read about are: character strings and the symbol used to raise a number to a power.
The function ssec2 is not a standard matlab function.
If you were running matlab at Rice University, then it would already be
available to you, but here at UB, it is not. Therefore, for this
problem, you will need to copy it to your home directory, or to a subdirectory
of your home directory called matlab. The ssec2 function is given
here.
Once you have placed it in your home directory or your matlab directory,
it will be available exactly like a built-in matlab function. It
uses the function ssec1, so you will also need to copy that function, which
is available here.
Test Problems
You may work these problems with help ONLY from the course instructor.
1) The formula for the period of a small body orbiting a massive one in an elliptical path is
T = ((4pi2 * a3)/(G*M)).5where a is half the major axis of the ellipse, M is the mass of the massive body, and G is the universal gravitation constant:
6.673 * 10-8 in the units: erg*cm/g2Develop an expression to compute this period for a satellite moving in an orbit of major axis A around a planet of mass M. Test the expression for:
M = 5.797 * 1027g ; A = 468,800 milesIt is suggested that you start by expressing all quantities in a consistent set of units such as cgs or SI. After doing that, what unit of time is given by your expression? Convert your answer to find the period in days if that is not the unit given by your expression.
2) "Solve" the three equations in two unknowns:
x1 - 0.1x2 = 2 3x1 + 4.0x2 = 1.8 5x1 + 7.5x2 = 2.5Check your results to see how closely the two unknowns satisfy the three equations.
3) Everyone "knows" that to find the minimum of a function, we need to locate a root of the derivative of the function. Maple was used to differentiate the function that gives the Total cost of running two reactors and was the subject of Lab Problem 3. Here is what Maple found for the derivative of the cost function:
Note that x is raised to the 0.4 power in the first term and the second term in the result also involves the 0.4 power. Use fplot to plot this function over the range (0.1 to 12.4). Why would you not want to extend this range to include 0 and 12.5? Use the function fzero to locate a root of the function in the interval 0 to 12.5. Does the root found with fzero agree with the plot? Then try ssec2. Use it to locate a root of this same function. In all of the functions you should be able to use the same character string to define the function that is plotted or searched for a root. What does the root that you find in this problem represent?