Question: Write a Matlab function that implements Heun's method for a first-order ODE. Your function should have the same inputs and outputs as function ode_eul with
Write a Matlab function that implements Heun's method for a first-order ODE. Your function should have the same inputs and outputs as function ode_eul with the addition of one new input, m; where m is the number of corrector steps to be taken. (1) Verify the above example using your function. (2) Use your function to solve the ODE in the above example for t belongs to [0 4] (use h = 1 and m = 3). Compare (by graphing) your solution to that of Euler's method (with h = 1) and to the exact solution. Your graph should look like the one in the following figure. Write a Matlab function that implements Heun's method for a first-order ODE. Your function should have the same inputs and outputs as function ode_eul with the addition of one new input, m; where m is the number of corrector steps to be taken. (1) Verify the above example using your function. (2) Use your function to solve the ODE in the above example for t belongs to [0 4] (use h = 1 and m = 3). Compare (by graphing) your solution to that of Euler's method (with h = 1) and to the exact solution. Your graph should look like the one in the following figure
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
