Question: Write a function to implement Heun's method with an option to iterate the corrector equation to a specified stopping criterion. Your function need only work

Write a function to implement Heun's method with an option to iterate the corrector equation to a specified stopping criterion. Your function need only work for a single ODE (not a system) defined as
dydt=f(t,y)
and should accept the following inputs (in order):
A function that defines the ODE to be solved. Your Heun function should accommodate optional parameter inputs if needed to evaluate dydt for given t and y values.
An evenly spaced time vector that defines the step size for the integration (by its increment) and the time span (first and last values) over which the IVP is to be integrated.
The initial condition y0.
A stopping criterion for the corrector iteration. If the stopping criterion is left blank, your function should default to implementing Heun's method without iterating the corrector equation.
Varargin to accept any optional parameters needed to evaluate dydt for given t and y values.
Your function should output the following (in order):
A column vector of y values corresponding to the input time vector.
The test suite will test your function for the following two ODEs:
dydt=t-y
dydt=kgm(1-yymax)y
Your Function
function [y,ea]= PA8_heun(dydt, time, ye, es, varargin)
%copy/paste the commands from your function here. You can change the
%names, but not the order, of the input and/or output variables in the
%function command to match your code. Do not change the name of the
6%function, however, as this exact name (i.e."PA8_heun") is
% required for the test suite to run.
end
 Write a function to implement Heun's method with an option to

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!