Chapter 08.04
Runge-Kutta 4th Order Method for Ordinary
Differential Equations-More Examples
Industrial Engineering
Example 1
The open loop response, that is, the speed of the motor to a voltage input of 20V, assuming a
system without damping is
dw
20 = (0.02) — + (0.06)
at
If the initial speed is zero (wo(0)= 0) .and using the Runge-Kutta 4* order method, what is
the speed at ¢= 0.88? Assume a step size of r=
Solution
ci
= 1000~3w
dt
Sf(tw)=1000-3w
2 + 2k, +2ky +k, Ve
k= Slt.)
= f(0,0)
= 1000-30
=1000
An +thw, +4
=f o-{4x04}0+/ | (000)<0.4 )
= f(0.2,200)
= 1000-3200
=400
dt 14)
k =d|ht gh Wet seh |
08.04.108.04.2 Chapter 08.04
1 1 \)
=f0o{ $04} 0-( L()<04))
= f(0.2,80)
= 1000-380
=760
ky =f (ty +iywy + kh)
= f(0+(0.4),0+((760)x0.4))
= f(0.4,304)
= 1000-3304
=88
a=W ha, + 2k, + 2k, +h Jh
=0 + £(1000 + 2x (400)+2(760)+(88))<0.4
= 0+ £(6408)x 0.4
27.2 rad/s
ay; is the approximate speed of the motor at
1=f, =) +h=0+04 =04s
(0.4) = w, = 227.2 rad/s
04, w, = 227.2
Slt. mi)
= f(04, 227.2)
000-3 227.2
184
Aa tony +h}
2 2
=s{ose{Fxos 272+{4¢184)x04))
2 )
k= Ar + Shaw +
=s(os+{[ x04} zmr2+ (Fear 36)x04)|
67)Runge-Kutta 4th Order Method for ODE-More Examples: Industrial Engineering
S(t, + haw, +h)
= f(0.4+0.4, 227.2 + (241.98x0.4))
£(0.8, 323.99)
1000-3 323.99
28.019
, +2 +2k, +2, +h,
Die aGisa +2 (127.36)+ 2 (241.98)+ 28.019) 0.4
=! 2272+ Z(1085 ixo4
= 299.54 rad/s
1vy isthe approximate speed of the motor at
121 =1, +1-04+04=085
10.8) = w, = 299.54 rad/s
The exact solution of the ordinary differential equation is given by
wna)
3 3
The solution to this nonlinear equation at
(0.8) = 303.09 rad/s
0.88 is
08.04.3,
Figure | compares the exact solution with the numerical solution using the Runge-Kutta 4*
order method using different step sizes.08.04.4 Chapter 08.04
350
300
250
200
150
Motor Speec (rad/s)
100} Exact
Ss
02 03 04 05 06 O07 O08
Time (s)
Figure 1 Comparison of Runge-Kutta 4 order method with exact solution for
different step sizes.
Table 1 and Figure 2 show the effect of step size on the value of the calculated speed of the
motor at = 0.85.
Table 1 Values of speed of the motor at 0.8 seconds for different step sizes.
Step size, ir | w{0.8) Ey le1%
Os 155.89 51.434
o4 3.5535 1.1724
02 0.12988 0.042852
OL 0.0062962 | 0.0020773
0.05 0.00034702 | 0.00011449Runge-Kutta 4th Order Method for ODE-More Examples: Industrial Engineering 08.04.5
350
300
250!
200
Motor Speed (rad/s), (0.8)
150
00>—G702 0304.05 08 07 08
Step Size (s)
-Kutta 4" order method.
Figure 2 Effect of step size in Rung
In Figure 3, we are comparing the exact results with Euler’s method (Runge-Kutta 1* order
method), Heun’s method (Runge-Kutta 2" order method) and the Runge-Kutta 4" order
method.08.04.6
Chapter 08.04
400)
350)
300} Euler Method,
250}
200}
150)
Motor Speec (rad/s)
100)
50}
0 O01 02 03 04 O58 O06 OF O8
Time (5)
Figure 3 Comparison of Runge-Kutta methods of 1", 2™, and 4" order.