Question: Modify the M-file euler.m to implement the algorithm for Improved Euler. Call the new file impeuler.m (include the file in your report). Test your code
Modify the M-file euler.m to implement the algorithm for Improved Euler. Call the new file impeuler.m (include the file in your report). Test your code for the ODE y 0 = 4y, y(0) = 2. First enter the function f(t, y) = 4y as anonymous function and then enter the following: >> [t5,y5] = impeuler(f,[0,.5],2,5); % use @f if defined in separate function >> [t5,y5] ans = 0 2.0000 0.1000 2.9600 0.2000 4.3808 0.3000 6.4836 0.4000 9.5957 0.5000 14.2016 Compare your output with the one above. Note that the improved Euler approximation with 5 steps is almost as accurate than the Euler approximation with 50 steps! (hence the improved)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
