06/19/22 http:// numericalmethods.eng.usf.edu 1 Runge 4 th Order Method Industrial Engineering Majors Authors: Autar Kaw, Charlie Barker http://numericalmethods.eng.u sf.edu Transforming Numerical Methods Education for STEM Undergraduates
Mar 28, 2015
04/10/23http://
numericalmethods.eng.usf.edu 1
Runge 4th Order Method
Industrial Engineering Majors
Authors: Autar Kaw, Charlie Barker
http://numericalmethods.eng.usf.eduTransforming Numerical Methods Education for STEM
Undergraduates
Runge-Kutta 4th Order Method
http://numericalmethods.eng.usf.edu
http://numericalmethods.eng.usf.edu3
Runge-Kutta 4th Order Method
where
hkkkkyy ii 43211 226
1
ii yxfk ,1
hkyhxfk ii 12 2
1,
2
1
hkyhxfk ii 23 2
1,
2
1
hkyhxfk ii 34 ,
For0)0(),,( yyyxf
dx
dy
Runge Kutta 4th order method is given by
http://numericalmethods.eng.usf.edu4
How to write Ordinary Differential Equation
Example
50,3.12 yeydx
dy x
is rewritten as
50,23.1 yyedx
dy x
In this case
yeyxf x 23.1,
How does one write a first order differential equation in the form of
yxfdx
dy,
http://numericalmethods.eng.usf.edu5
ExampleThe open loop response, that is, the speed of the motor to a voltage input of 20 V, assuming a system without damping is
wdt
dw06.002.020
If the initial speed is zero , and using the Runge-Kutta 4th order method, what is the speed at t = 0.8 s? Assume a step size of h = 0.4 s.
wdt
dw31000
wwtf 31000,
hkkkkww ii 43211 226
1
00 w
http://numericalmethods.eng.usf.edu6
SolutionStep 1: For 00,0 00 wti
10000310000,0, 001 fwtfk
40020031000200,2.04.010002
10,4.0
2
10
2
1,
2
11002
ffhkwhtfk
760803100080,2.04.04002
10,4.0
2
10
2
1,
2
12003
ffhkwhtfk
8830431000304,4.04.07600,4.00, 3004 ffhkwhtfk
http://numericalmethods.eng.usf.edu7
Solution Cont
rad/s2.227
4.034086
10
4.0887602400210006
10
)22(6
1432101
hkkkkww
is the approximate speed of the motor at1w
s4.04.0001 httt
rad/s2.2274.0 1 ww
http://numericalmethods.eng.usf.edu8
Solution ContStep 2: 2.227,8.0,1 11 wti
4.3182.227310002.227,4.0, 111 fwtfk
36.12788.2903100088.290,6.0
4.04.3182
12.227,4.0
2
14.0
2
1,
2
11112
f
fhkwhtfk
98.24167.2523100067.252,6.0
4.036.1272
12.227,4.0
2
14.0
2
1,
2
12113
f
fhkwhtfk
019.2899.3233100099.323,8.0
4.098.2412.227,4.04.0, 3114
f
fhkwhtfk
http://numericalmethods.eng.usf.edu9
Solution Cont
rad/s54.299
4.01.10856
12.227
4.0019.2898.241236.12724.3186
12.227
)22(6
1432112
hkkkkww
is the approximate speed of the motor at2w
s8.04.04.012 httt
rad/s54.2998.0 2 ww
http://numericalmethods.eng.usf.edu10
Solution Cont
The exact solution of the ordinary differential equation is given by
The solution to this nonlinear equation at t=0.8 seconds is
tetw 3
3
1000
3
1000)(
rad/s09.3038.0 w
http://numericalmethods.eng.usf.edu11
Comparison with exact results
Figure 1. Comparison of Runge-Kutta 4th order method with exact solution
Step size,
0.80.40.20.1
0.05
147.20299.54302.96303.09303.09
155.893.5535
0.129880.0062962
0.00034702
51.4341.1724
0.0428520.0020773
0.00011449
http://numericalmethods.eng.usf.edu12
Effect of step size
h tE %|| t
(exact)
Table 1 Values of speed of the motor at 0.8 seconds for different step sizes
09.3038.0 w
8.0w
http://numericalmethods.eng.usf.edu13
Effects of step size on Runge-Kutta 4th Order Method
Figure 2. Effect of step size in Runge-Kutta 4th order method
http://numericalmethods.eng.usf.edu14
Comparison of Euler and Runge-Kutta Methods
Figure 3. Comparison of Runge-Kutta methods of 1st, 2nd, and 4th order.
Additional ResourcesFor all resources on this topic such as digital audiovisual lectures, primers, textbook chapters, multiple-choice tests, worksheets in MATLAB, MATHEMATICA, MathCad and MAPLE, blogs, related physical problems, please visit
http://numericalmethods.eng.usf.edu/topics/runge_kutta_4th_method.html