Question: Please solve using Matlab Task 2: Solving Differential Equations using Heun's, Midpoint methods [25 marks] (a) Write a function that uses the Heun's method to

Please solve using MatlabPlease solve using Matlab Task 2: Solving Differential Equations using Heun's, Midpoint

Task 2: Solving Differential Equations using Heun's, Midpoint methods [25 marks] (a) Write a function that uses the Heun's method to find y(t) with a step size h, tspan, and initial value yO an inputs. Your function should start as follows: function [t,ylheun (dydt, tspan, yo,h) (b) Write a function that uses the Midpoint method to find y(t) with a step size h, tspan, and initial value y0 an inputs. Your function should start as follows function It, y) - midpoint (dydt,tspan, y0,h) (c) Write an M-file that calculates the y(4) using Heun's method, Midpoint method for step size of h-1, 0.5, and 0.25 with an initial condition y(0)-2. Create 3 subplots that contain the graphs of the Heun's method (use blue line and dot markers), Midpoint method (use green line) and ODE45 plot (use red circle markers) for each step size h. Label your plots accordingly. Hint: Use ODE from Task 1 and use the functions from part (a) and (b)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!