## Numerical Assignment Midterm 2B

You may work with one other person to develop and run the software you use to complete this

assignment. You must write up your own report.

Use the Euler, Improved Euler, and Runge-Kutta methods with a computer system (MATLAB

recommended) to solve approximately the following ODE and to obtain an approximation of the

indicated solution value. Use step sizes of

h ? 0.5, 0.1, 0.05,0.01, 0.005,0.001,0.0005,0.0001,0.00005,0.00001 or as close to these values as possible.

Looking at what happens as h?0 , what is your best numerical estimate of the exact solution?

[Hint: my value is 8.23434]. Using this result, compute and plot the error as a function of h for

each of the methods. From your results, what can you conclude about the relative accuracy of the

three methods?

2 2 1

‘ 1, (0) 0, (2) ?

5

y ? x ? y ? y ? y ?

The textbook has listings of MATLAB code for the three methods. Type them into MATLAB and run

them to get your test results. Be sure to modify the function f appropriately for this assignment.

You should create several MATLAB files, each containing one MATLAB function.

1) f.m – containing the function f (text pp. 124 – but modify it for this assignment)

2) euler.m – containing the function euler (text pp. 124)

3) impeuler.m – containing the function impeuler (text pp. 134)

4) rk.m – containing the function rk (text pp. 145)

Then invoke each numerical solver as follows:

[X,Y]=euler(0,0,2,2/h); [or “impeuler”, or “rk”]

Y(end)

The last MATLAB statement will display the computed estimate for y(2). Note that MATLAB is case

sensitive.

Write a report (MS Word document) containing your test results, analysis, and conclusion. It

should also include a listing of your code and acknowledgement of your software “coding buddy”.

If you need help getting MATLAB to work for you, I recommend that you go either to the

engineering lab on the second floor of North Classroom, or the math lab on the fourth floor of

North Classroom (NC4009). In both places there are staff who can help you. If you get stuck,

PLACE THIS ORDER OR A SIMILAR ORDER WITH US TODAY AND GET AN AMAZING DISCOUNT ðŸ™‚