Subroutine predictor corrector - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Subroutine predictor corrector

DaliaViolaDaliaViola Posts: 3Member
Hello everyone!!! I'm writing because I should write this subroutine:

Given the Cauchy problem


write a subroutine for the calculation of its solution using the predictor corrector method in 5 steps (k = 4), according to the PECE scheme, with fixed step.

for the initiation values use the Matlab routine ode45.

So, I have this program but I need of to do some tests but I don't understand what kind of functions I should, you can give me an example of tests that can I do? This is the program:

% The function calculates the solution of the Cauchy problem
% y'=f(t,y)
% y()=y0

% takes as input a function, the initial condition, the extremes of the %integration interval and the width of interval

function [t,y]=pece(fty,y0,x0,xn,h)
for i=1:p+1


for i=1:4
[t0,m_i]=ode45(fty,[t(1) t(2) t(3) t(4)],y0);


for i = 4:p
fnew= feval (fty, t0(4), mi);
f_i0= feval (fty, t0(4)+h, m_i0);
mi= mi+(h/24)*(9*f_i0+19*fnew-5*f(3,:)+f(2,:));
f(1,:) = f(2,:);
f(2,:) = f(3,:);
f(3,:) = fnew;
t0 = t0 + h;
y(i+1,:)= mi;



Sorry for my mistakes...but I am Italian!!!! Thanks in advance!!!!
Sign In or Register to comment.