Runge-Kutta 4th Order Method For Ordinary Differential Equations-More Examples Computer Engineering
Runge-Kutta 4th Order Method For Ordinary Differential Equations-More Examples Computer Engineering
04
Runge-Kutta 4th Order Method for Ordinary
Differential Equations-More Examples
Computer Engineering
Example 1
A rectifier-based power supply requires a capacitor to temporarily store power when the
rectified waveform from the AC source drops below the target voltage. To properly size this
capacitor a first-order ordinary differential equation must be solved. For a particular power
supply, with a capacitor of 150 μF , the ordinary differential equation to be solved is
dv(t ) 1
18 cos120 t 2 v t
0.1 max ,0
dt 150 10 6
0.04
v (0) 0
Using the Runge-Kutta 4th order method, find voltage across the capacitor at t 0.00004 s .
Use step size h 0.00002 s .
Solution
dv 1
18 cos120 t 2 v
0.1 max ,0
dt 150 10 6
0.04
1
18 cos120 t 2 v
f t, v 0.1 max ,0
150 10 6
0.04
1
vi 1 vi k1 2 k 2 2 k 3 k 4 h
6
For i 0 , t 0 0 , v 0 0
k1 f t 0 , v 0
f 0,0
1
18 cos120 0 2 0
0.1 max ,0
150 10 6
0.04
1
0.1 max 400,0
150 10 6
1
0.1 400
150 10 6
2.6660 10 6
08.05.1
08.05.2 Chapter 08.05
1 1
k 2 f t 0 h, v 0 k 1 h
2 2
f 0 0.00002 ,0 2.6660 106 0.00002
1 1
2 2
f 0.00001,26.660
1
18 cos120 0.00001 2 26.660
0.1 max ,0
150 10 6
0.04
1
0.1 max 266.50,0
150 10 6
1
0.1 266.50
150 10 6
666.67
1 1
k 3 f t 0 h, v 0 k 2 h
2 2
1 1
f 0 0.00002 ,0 666.67 0.00002
2 2
f 0.00001,0.0066667
1
18 cos120 0.00001 2 0.0066667
0.1 max ,0
150 10 6
0.04
1
0.1 max 400.16,0
150 10 6
1
0.1 400.16
150 10 6
2.6671 106
k 4 f t 0 h, v 0 k 3 h
f 0 0.00002,0 2.6671 10 6 0.00002
f 0.00002 , 53.342
1
18 cos120 0.00002 2 53.342
0.1 max ,0
150 10 6
0.04
1
0.1 max 933.56,0
150 10 6
1
0.1 0
150 10 6
666.67
1
v1 v 0 ( k1 2 k 2 2 k 3 k 4 ) h
6
0 2.6660 106 2 666.67 2 2.6671 106 666.67 0.00002
1
6
1
0 7.9982 10 6 0.00002
6
26.661 V
Runge-Kutta 4th Order Method for ODE-More Examples: Computer Engineering 08.05.3
1
18 cos120 0.00003 2 26.634
0.1 max ,0
150 10 6
0.04
1
0.1 max 265.87,0
150 10 6
1
0.1 0
150 10 6
666.67
1
v 2 v1 ( k1 2 k 2 2 k 3 k 4 ) h
6
1
26.661 666.67 2 666.67 2 666.67 666.67 0.00002
6
1
26.661 4000.0 0.00002
6
26.647 V
v 2 is the approximate voltage at t t 2
t 2 t1 h = 0.00002 0.00002 0.00004 s
v .00004 v 2 26.647 V
Figure 1 compares the exact solution of v 0.00004 15.974 V with the numerical solution
using Runge-Kutta 4th order method step size of h 0.00002 s .
Runge-Kutta 4th Order Method for ODE-More Examples: Computer Engineering 08.05.5
Figure 1 Comparison of Runge-Kutta 4th order method with exact solution for
different step sizes.
Table 1 and Figure 2 shows the effect of step size on the value of the calculated temperature
at t 0.00004 s .
In Figure 3, we are comparing the exact results with Euler’s method (Runge-Kutta 1 st order
method), Heun’s method (Runge-Kutta 2nd order method) and Runge-Kutta 4th order method.
Runge-Kutta 4th Order Method for ODE-More Examples: Computer Engineering 08.05.7