Sie sind auf Seite 1von 7

Chapter 08.

04
Runge-Kutta 4th Order Method for
Differential Equations-More Examples
Computer Engineering

Ordinary

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

dt
150 10 6

v(0) 0

18 cos120 t 2 vt
,0
0.1 max
0.04

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
1
dv

dt 150 10 6
f t , v

18 cos120 t 2 v
,0
0.1 max
0
.
04

1
150 10 6

18 cos120 t 2 v
,0
0.1 max
0.04

1
k1 2k 2 2k 3 k 4 h
6
For i 0 , t 0 0 , v0 0
k1 f t 0 , v0
f 0,0
vi 1 vi

08.05.1

18 cos120 0 2 0
,0
0.1 max
0
.
04

1
150 10 6

1
0.1 max 400,0
150 10 6

08.05.2

Chapter 08.05
1
0.1 400
150 10 6
2.6660 106
1
1

k 2 f t 0 h, v0 k1 h
2
2

1
1

f 0 0.00002 ,0 2.6660 10 6 0.00002


2
2

f 0.00001,26.660

1
150 10 6

18 cos120 0.00001 2 26.660


,0
0.1 max
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
150 10 6

18 cos120 0.00001 2 0.0066667


,0
0.1 max
0
.
04

1
0.1 max400.16,0
150 10 6
1
0.1 400.16

150 10 6
2.6671 106
k 4 f t 0 h, v0 k 3 h

f 0 0.00002,0 2.6671 10 6 0.00002


f 0.00002 , 53.342

1
150 10 6

18 cos120 0.00002 2 53.342


,0
0.1 max
0
.
04

1
0.1 max 933.56,0
150 10 6
1
0.1 0

150 10 6
666.67

Runge-Kutta 4th Order Method for ODE-More Examples: Computer Engineering


1
v1 v0 (k1 2k 2 2k 3 k 4 )h
6
1
0 2.6660 106 2 666.67 22.6671 106 666.67 0.00002
6
1
0 7.9982 10 6 0.00002
6
26.661 V
v1 is the approximate voltage at
t t1 t 0 h 0 0.00002 0.00002
v0.00002 v1 26.661 V
For i 1, t1 0.00002, v1 26.661
k1 f t1 , v1
f 0.00002,26.661

1
150 10 6

18 cos120 0.00002 2 26.661


,0
0.1 max
0
.
04

1
0.1 max 266.51,0
150 10 6
1
0.1 0

150 10 6
666.67
1
1

k 2 f t1 h, v1 k1 h
2
2

1
1

f 0.00002 0.00002,26.661 666.67 0.00002


2
2

f 0.00003,26.654

1
150 10 6

18 cos120 0.00003 2 26.654


,0
0.1 max
0
.
04

1
0.1 max 266.35,0
150 10 6
1
0.1 0

150 10 6
666.67
1
1

k 3 f t1 h, v1 k 2 h
2
2

1
1

f 0.00002 0.00002,26.661 666.67 0.00002


2
2

f 0.00003,26.654

08.05.3

08.05.4

Chapter 08.05

1
150 10 6

18 cos120 0.00003 2 26.654


,0
0.1 max
0
.
04

1
0.1 max 266.35,0
150 10 6
1
0.1 0

150 10 6
666.67
k 4 f t1 h, v1 k 3 h
f 0.00002 0.00002 ,26.661 666.67 0.00002
f 0.00003,26.647

1
150 10 6

18 cos120 0.00003 2 26.634


,0
0.1 max
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 2k 2 2k 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 v0.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 .
Table 1 Value of voltage at time, t 0.00004 s for different step sizes.

Step size, h

v0.00004

0.00004
0.00002
0.00001
0.000005
0.0000025

53.335
26.647
15.986
15.975
15.976

Et

|t | %

37.361
10.673
0.012299
0.00050402
0.0015916

233.89
66.817
0.076996
0.0031552
0.0099639

08.05.6

Chapter 08.05

Figure 2 Effect of step size in Runge-Kutta 4th order method.

In Figure 3, we are comparing the exact results with Eulers method (Runge-Kutta 1st order
method), Heuns method (Runge-Kutta 2nd order method) and Runge-Kutta 4th order method.

Runge-Kutta 4th Order Method for ODE-More Examples: Computer Engineering

Figure 3 Comparison of Runge-Kutta methods of 1st, 2nd, and 4th order.

08.05.7

Das könnte Ihnen auch gefallen