Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 Matlab
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started