Problem 1:

advertisement
Problem 1:
1) Copy the code in a matlab file called plot_bessel_usinig_ode.m and run it on the
command prompt. The sample command line input and the graph obtained are as follows.
>> plot_bessel_using_ode(10)
>>
Bessel function of first kind using solution from ode
1
y(x)
0.5
0
-0.5
0
2
4
6
8
10
x
2) I have made a matlab file plot_bessel_using_besselj which contains the function
of the same name. We can run the command on matlab window.
>> plot_bessel_using_besselj(10);
>>
The output plot obtained is as follows.
Cite as: William Green, Jr., course materials for 10.34 Numerical Methods Applied to
Chemical Engineering, Fall 2006. MIT OpenCourseWare (http://ocw.mit.edu),
Massachusetts Institute of Technology. Downloaded on [DD Month YYYY].
Bessel function of first kind using besselj
1
y(x)
0.5
0
-0.5
0
2
4
6
8
10
x
3) The function which uses the truncated infinite series to get the solution is written in matlab file “plot_bessel_using_my_bessel.m”
The sample input is given below and the output graphs are also presented. >> plot_bessel_using_my_bessel(10) >> Cite as: William Green, Jr., course materials for 10.34 Numerical Methods Applied to
Chemical Engineering, Fall 2006. MIT OpenCourseWare (http://ocw.mit.edu),
Massachusetts Institute of Technology. Downloaded on [DD Month YYYY].
Bessel function of first kind using mybessel
1
y(x)
0.5
0
-0.5
0
2
4
6
8
10
x
Number of terms included while using mybessel
16
14
number of terms
12
10
8
6
4
2
0
0
2
4
6
8
10
x
Cite as: William Green, Jr., course materials for 10.34 Numerical Methods Applied to
Chemical Engineering, Fall 2006. MIT OpenCourseWare (http://ocw.mit.edu),
Massachusetts Institute of Technology. Downloaded on [DD Month YYYY].
Homework Set #1
Problem #2 Solution
Vapor Volume Root (fzero, V_guess=50) (L/mole): 24.3051
Vapor Volume Root (fsolve, V_guess=50) (L/mole): 24.3051
Vapor Volume Root (fminsearch, V_guess=50) (L/mole): 24.3051
25
fzero Result
fsolve Result
fminsearch Result
EOS b-value (lower physical limit)
Resulting Volume [L/mole]
20
15
10
5
0
0
5
10
15
20
25
30
Volume Initial Guess [L/mole]
35
40
45
50
The plot appears to show that fzero does not perform as robustly as fsolve and
fminsearch, which both yield the correct root over the entire range of guesses. In this
case we are not concerned with the numerical noise in the solution near the root, as this
can be reduced by changing the tolerances of the solver. Adjusting the tolerances may
also help fzero find the correct root more robustly.
Cite as: William Green, Jr., course materials for 10.34 Numerical Methods Applied to
Chemical Engineering, Fall 2006. MIT OpenCourseWare (http://ocw.mit.edu),
Massachusetts Institute of Technology. Downloaded on [DD Month YYYY].
Homework Set #1
Problem #3 Solution
Rate constant plot:
Text file output:
Excel file output:
Rate constant data for:
NH2OH + HO2 --> NH2O. + HOOH
Rate constant data for:
NH2OH + HO2 --> NH2O. + HOOH
Temp (K)
300
400
500
600
700
800
900
1000
1100
1200
1300
1400
1500
k(T) (cm3/mole-s)
3.140102e+003
1.488662e+005
1.793926e+006
1.058311e+007
4.082521e+007
1.195183e+008
2.891187e+008
6.090090e+008
1.155976e+009
2.024043e+009
3.323935e+009
5.182339e+009
7.741104e+009
Temp (K)
k(T) (cm3/mole-s)
300
3.14E+03
400
1.49E+05
500
1.79E+06
600
1.06E+07
700
4.08E+07
800
1.20E+08
900
2.89E+08
1000
6.09E+08
1100
1.16E+09
1200
2.02E+09
1300
3.32E+09
1400
5.18E+09
1500
7.74E+09
Cite as: William Green, Jr., course materials for 10.34 Numerical Methods Applied to
Chemical Engineering, Fall 2006. MIT OpenCourseWare (http://ocw.mit.edu),
Massachusetts Institute of Technology. Downloaded on [DD Month YYYY].
Download