Runge-Kutta-Fehlberg (RKF78)
Version 2.1.1 (7.74 KB) by
Meysam Mahooti
Fehlberg's 7th and 8th Order Embedded Method
The Runge-Kutta-Fehlberg method is an adaptive procedure for approximating the solution of the differential equation y'(x) = f(x,y) with initial condition y(x0) = c. This implementation evaluates f(x,y) thirteen times per step using embedded seventh order and eight order Runge-Kutta estimates to estimate the not only the solution but also the error.
The next step size is then calculated using the preassigned tolerance and error estimate.
For step i+1,
y[i+1] = y[i] + h * (41/840 * k1 + 34/105 * k6 + 9/35 * k7 + 9/35 * k8 + 9/280 * k9 + 9/280 k10 + 41/840 k11 )
where
k1 = f( x[i],y[i] ),
k2 = f( x[i]+2h/27, y[i] + 2h*k1/27),
k3 = f( x[i]+h/9, y[i]+h/36*( k1 + 3 k2) ),
k4 = f( x[i]+h/6, y[i]+h/24*( k1 + 3 k3) ),
k5 = f( x[i]+5h/12, y[i]+h/48*(20 k1 - 75 k3 + 75 k4)),
k6 = f( x[i]+h/2, y[i]+h/20*( k1 + 5 k4 + 4 k5 ) ),
k7 = f( x[i]+5h/6, y[i]+h/108*( -25 k1 + 125 k4 - 260 k5 + 250 k6 ) ),
k8 = f( x[i]+h/6, y[i]+h*( 31/300 k1 + 61/225 k5 - 2/9 k6 + 13/900 K7) )
k9 = f( x[i]+2h/3, y[i]+h*( 2 k1 - 53/6 k4 + 704/45 k5 - 107/9 k6 + 67/90 k7 + 3 k8) ),
k10 = f( x[i]+h/3, y[i]+h*( -91/108 k1 + 23/108 k4 - 976/135 k5 + 311/54 k6 - 19/60 k7 + 17/6 K8 - 1/12 k9) ),
k11 = f( x[i]+h, y[i]+h*( 2383/4100 k1 - 341/164 k4 + 4496/1025 k5 - 301/82 k6 + 2133/4100 k7 + 45/82 K8 + 45/164 k9 + 18/41 k10) ),
k12 = f( x[i], y[i]+h*( 3/205 k1 - 6/41 k6 - 3/205 k7 - 3/41 K8 + 3/41 k9 + 6/41 k10) ),
k13 = f( x[i]+h, y[i]+h*( -1777/4100 k1 - 341/164 k4 + 4496/1025 k5 - 289/82 k6 + 2193/4100 k7 + 51/82 K8 + 33/164 k9 + 12/41 k10 + k12) )
x[i+1] = x[i] + h.
The error is estimated to be err = -41/840 * h * ( k1 + k11 - k12 - k13)
The step size h is then scaled by the scale factor scale = 0.8 * | epsilon * y[i] / [err * (xmax - x[0])] | ^ 1/7
The scale factor is further constrained 0.125 < scale < 4.0.
The new step size is h := scale * h.
Reference:
J. Stoer, R. Bulirsch, Introduction to Numerical Analysis (Texts in Applied Mathematics), 3rd edition, 2002.
Cite As
Meysam Mahooti (2024). Runge-Kutta-Fehlberg (RKF78) (https://www.mathworks.com/matlabcentral/fileexchange/61130-runge-kutta-fehlberg-rkf78), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2024a
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Numerical Integration and Differential Equations in Help Center and MATLAB Answers
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Runge_Kutta_Fehlberg_7(8)
Version | Published | Release Notes | |
---|---|---|---|
2.1.1 | test_Runge_Kutta_Fehlberg_7_8.m was modified. |
||
2.1.0.0 | test_Runge_Kutta_Fehlberg_7_8.m is modified and output.txt is added to reveal tremendous accuracy and speed of Runge-Kutta-Fehlberg (RKF78). |
||
2.0.0.0 | test_Runge_Kutta_Fehlberg_7_8.m is modified. |
||
1.1 | Title is changed. |
||
1.0.0.0 |