0% found this document useful (0 votes)
50 views3 pages

Predictor Corrector Methods

The document discusses the Runge-Kutta fourth-order (RK4) method for numerically solving differential equations and introduces predictor-corrector methods. It provides the RK4 code and notes that two additional PDFs about RK methods and predictor-corrector methods will provide more theoretical background to help understand how these numerical methods work. While knowledgeable about the theory, the author acknowledges being unable to help with programming questions.

Uploaded by

Hamid Nasir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views3 pages

Predictor Corrector Methods

The document discusses the Runge-Kutta fourth-order (RK4) method for numerically solving differential equations and introduces predictor-corrector methods. It provides the RK4 code and notes that two additional PDFs about RK methods and predictor-corrector methods will provide more theoretical background to help understand how these numerical methods work. While knowledgeable about the theory, the author acknowledges being unable to help with programming questions.

Uploaded by

Hamid Nasir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Predictor corrector methods

The task
The RK4 code that is mentioned above is as follows:
function [y,fvalues] = RK4(f,h,y0,a,s)

y=zeros(1,s+1);
fvalues=zeros(1,s+1);
y(1)=y0;
b = a+s*h;
t = a:h:b;

for i=1:s
fvalues(i) = f(t(i),y(i));
k1=h*fvalues(i);
k2=h*f(t(i)+h/2,y(i)+k1/2);
k3=h*f(t(i)+h/2,y(i)+k2/2);
k4 =h*f(t(i)+h,y(i)+k3) ;
y(i+1)=y(i)+ (1/6)*(k1+2*k2+2*k3+k4);
end
fvalues(s+1) = f(t(s+1),y(s+1));
end
I will attach two separate PDF’s that give more information about RK(The
Runge-Kutta method) and about predictor corrector methods as, it should help
with understanding of how the theory of the methods works and how they
work on paper.

I’m knowledgeable on the written theory and can do written exercises easily so
I can answer any questions to do with the theory however, I’m useless at
programing so I won’t be able to help at all there.
Best of luck and thanks.

You might also like