CS 221 Fall 2011 Problem Set 5
Note: There is no penalty for turning in this problem set late, but submissions will not be accepted after solutions are posted on or about Friday, 9 December.
Please read the submission instructions carefully. Failure to submit the proper items may cost you points.
For any problem you use MATLAB to solve, create a record of your calculations in MATLAB, using the diary command. Name the diary file "PS5-#", where "#" is the problem number, e.g. "1a".
P = (nRT)/(V-b) - (n²a)/V²
where n is the number of moles, R = 0.08206 (L atm)/(mole K) is the gas constant, and a and b are material constants. Consider 1.5 moles of Nitrogen (a=1.39 L² atm/mole², b=0.03919 L/mole) at 25° C stored in a pressure vessel. Determine the volume of the vessel if the pressure is 13.5 atm.Solve the following systems of linear equations Ax=b using MATLAB or Excel:
A =
10 -1 3 0 77
0 2 -5 3 6
21 -4 0 -14.5 17
3 12 1.5 37 -9
-4 5 -3 22 0
b =
-58
37
249
448
67
A =
-17.9 -1.9 -12.0 -20.5 -2.9 9.6 -5.8 7.9 8.6 -0.6
8.4 -21.3 29.0 -3.5 0.2 5.2 -2.9 -13.3 -13.6 -1.9
-8.8 -8.3 8.2 -8.2 -2.6 -0.2 -8.4 -23.2 4.5 -2.1
1.0 13.5 13.7 -15.7 -17.5 -0.3 -11.2 -14.4 -8.4 -3.0
-5.4 -10.7 -10.5 5.0 -2.8 -7.9 25.2 3.3 -3.3 0.2
3.0 9.6 -4.6 2.8 -8.3 10.1 16.5 3.9 5.5 0.5
-6.0 1.2 -2.7 0.3 -9.7 -1.3 3.0 4.5 10.3 8.2
4.8 14.3 10.9 -13.3 -11.5 -7.1 -12.5 -1.3 -11.1 15.2
7.3 -19.6 -2.7 11.2 -5.3 13.5 -8.6 1.8 12.6 4.6
17.1 -1.9 7.0 3.5 -20.0 -2.2 -1.7 -4.7 6.6 -2.0
b =
-2.6
-197.1
-272.7
-382.2
75.4
239.9
164.9
-133.0
172.9
-75.0
(Note: For the second problem, a text file containing A
is here, and one for b is
here.
| Nonlinear Equation | Linear Form |
|---|---|
| y = bxm | ln(y) = mln(x) + ln(b) |
| y = bemx | ln(y) = mx + ln(b) |
| y = 1/(mx + b) | 1/y = mx + b |
| y = (mx)/(x + b) | 1/y = b/mx + 1/m |
R = R0[1 + α(T-T0)]
where R0 is the resistance corresponding to temperature T0, and α is the temperature coefficient of resistance. Determine R0 and α such that the equation will best fit the following data. Use T0=20° C.| T (° C) | 20 | 100 | 180 | 260 | 340 | 420 | 500 |
| R (Ω) | 500 | 676 | 870 | 1060 | 1205 | 1410 | 1565 |
4.72 7.18 12.49 7.30 20.03 7.37 28.33 7.42 37.47 7.47 41.43 7.50 48.38 7.53 55.06 7.55 66.77 7.58 59.16 7.56 54.45 7.55 47.21 7.53 42.75 7.51 32.71 7.47 25.43 7.44 8.18 7.28Determine the coefficients A and B of the exponential function u=AeBV that best fit the data. (Hint: transform the equation as suggested by the above table and use MATLAB's polyfit() function.)
| Age (years) | 5 | 10 | 15 | 20 | 25 | 30 | 35 |
| Height (m) | 5.2 | 7.8 | 9 | 10 | 10.6 | 10.9 | 11.2 |
Important: Verify that the contents of the zip archive are correct. It should contain the directory (folder) and the three files, and nothing else. (Do this by double-clicking the zip file.)
Important: save the folder and its contents to a flash drive or elsewhere, for two reasons: (i) in case something goes wrong with your submission; and (ii) we will sometimes build on your solutions in later problems.