MATLAB EC

profilewaleed39
mat_275_extra_credit_lab.pdf

MAT 275 Extra Credit MatLab Euler’s Method and Improved Euler’s Method

1. Determine the Euler’s approximations for problem #7 in written exam 1 using the

euler.m file and the code below.

In your command window, use the Matlab command code (filling in the proper information) to obtain the results that you need for the report.

>> f=inline(’input function here’,’t’,’y’); >> [t4,y4]=euler(f,[0,1],?input y0 value? , 4); % solves the ODE using Euler with 4 steps >> [ti4(:),yi4(:)]% shows results of the method

2. Repeat the process by determining the Improved Euler’s approximations for

problem #8 in written exam 1 using the impeuler.m file and the code below.

>> f=inline(’input function here’,’t’,’y’); >> [ti4,yi4]=impeuler(f,[0,1],?input y0 value? , 4); % solves using Improved Euler w/4 steps >> [ti4(:),yi4(:)]% shows results of the method

3. Lab Write up: Submit the following as a word document or PDF file using the submit link in Blackboard. 1. Build the following table with the values of the approximations you obtained in step

1 (Euler’s method). Actual Value of the solution of the DE at each step, the Absolute Error and % Rel. Error.

x Approximate

Values using

Euler’s Method

Actual Value Absolute Error % Rel. Error

0

0.25

0.5

0.75

1.0

2. Build the following table with the values of the approximations you obtained in step

2 (Improved Euler’s method). Actual Value of the solution of the DE at each step, the Absolute Error and % Rel. Error.

x

Approximate

Values using

IMPROVED

Euler’s Method

Actual Value Absolute Error % Rel. Error

0

0.25

0.5

0.75

1.0

3. Provide a single graph generated by Matlab, plotting the results of the Euler’s method,

Improved Euler’s Method and the values of the EXACT Solution. Make sure you provide the

proper labeling for each curve.

4. Submit a scanned copy of pages 7, 8 and 9 from your written exam 1 with the lab report. If

these pages are not included no extra credit can be assigned.

5. Submit the entire document using the link in blackboard.