Professional Documents
Culture Documents
IF-392
Clase 05
Dr. Luis Sanchez
Adaptive Methods
Adaptive Runge Kutta Method
For an ODE with an
abrupt changing
solution, a constant
step size can represent
a serious limitation.
y2 y1
Error estimate
y2 y2 Correction – 5th-order
15
Exercise 01
Use the Step Halving Method in Octave to approximate the solutions
to the following initial-value problems. Compare the results to the
actual values.
2.1 Embedded Runge-Kutta Method
Algorithm (Bogacki and Shampine, 1989; Shampine, 1994)
Use 3rd-order & 4th-order RK methods simultaneously to
solve the ODE and estimate the error for step-size adjustment
MATLAB function: ODE23
OCTAVE function: ODE23
k 1 f ( t i , yi )
1 1 1
yi 1 yi ( 2 k1 3 k2 4 k3 ) h ; k2 f ( t i h, yi k1 h)
9 2 2
3 3
k 3 f ( x i h, y i k2 h)
4 4
1
Ei1 ( 5 k 1 6 k 2 8 k 3 9 k 4 ) h ; k 4 f ( t i 1 , yi 1 )
72
dy ( t 2 ) 2 /[ 2 ( 0.075 ) 2 ]
0.6 y 10 e ; y(0 ) 0.5
dt
function yp = exercise02(t, y)
yp = 10*exp(-(t-2)*(t-2)/(2*0.075^2)) - 0.6*y;
endfunction
Exercise 02: ode23
>> options = odeset('RelTol',1.e-3); >> options = odeset('RelTol',1.e-4);
>> ode23('ex21_2', [0 4], 0.5, options); >> ode23('ex21_2', [0 4], 0.5,
options);
k1 f ( xi , yi )
These coefficients were developed
1 1
k2 f ( xi h, yi k1h) by Cash and Karp (1990). Also
5 5 called Cash-Karp RK Method
3 3 9
k3 f ( xi h, yi k1h k2 h)
10 40 40
3 3 9 6
k4 f ( xi h, yi k1h k2 h k3h)
5 10 10 5
k 11 5
f ( xi h, yi k1h k2 h
70
k3 h
35
k4 h)
5 54 2 27 27
k 7 1631 175 575 44275 253
f ( xi h, yi k1h k2 h k3 h k4 h k5 h )
6
8 55296 512 13824 110592 4096
Runge-Kutta Fehlberg Method
Forcing function
Runge-Kutta-Fehlberg
method with adaptive
step size control t