Professional Documents
Culture Documents
001-Runge Kutta Methods Presentation-V4
001-Runge Kutta Methods Presentation-V4
1
RK-4
• The Runge-Kutta method is the most popular method for solving ordinary
differential equations (ODEs) by means of numerical approximations.
• There are several version of the method depending on the desired accuracy.
• The most popular RK method is of fourth order (i.e., RK-4), which in simpler terms
means that the error is of the order of h4 , abbreviated as O(h4).
2
RK-4
initially, i.e., @ 𝑡𝑗
ℎ
at half interval, i.e., @ 𝑡𝑗 + 2
ℎ
at half interval, i.e., @ 𝑡𝑗 +
2
5
matlab program:
% RK-4
clc, clear
h=0.1; a=0; b=3; % h is the step size, t=[a,b] is the domain
t = a:h:b; % Computes t-array from a to b, in steps of h; initial time is t(1)
y(1) = 5; % initial condition; in MATLAB indices start at 1
F= @(t,y) 3.*exp(-t)-0.4*y; % the RHS function of Euler’s standard format
for ii=1:1:numel(t)-1 % numel(t) computes the number of elements of t-array (i.e., nodes)
k1 = F(t(ii),y(ii));
k2 = F(t(ii)+0.5*h,y(ii)+0.5*h*k1);
k3 = F((t(ii)+0.5*h),(y(ii)+0.5*h*k2));
k4 = F((t(ii)+h),(y(ii)+h*k3));
y(ii+1) = y(ii) + (h/6)*(k1+2*k2+2*k3+k4); % main equation
end
7
Numerical Solution
8
List of Runge Kutta
• https://en.wikipedia.org/wiki/List_of_Runge%E2%80%93Kutta_methods