Euler`s Method for Ordinary Differential Equations

advertisement
Chapter 08.03
Runge-Kutta 2nd 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w
dt
If the initial speed is zero; use the Runge-Kutta 2nd order method and a step size of
h  0.4 s to find the speed at t  0.8 s .
Solution
dw
 1000  3w
dt
f w,t   1000  3w
Per Heun’s method
1 
1
wi 1  wi   k1  k 2 h
2 
2
k1  f wi , t i 
k 2  f wi  h, t i  k1h
For i  0, t 0  0, w0  0
k1  f t 0 , w0 
 f 0,0
 1000  3  0
 1000
k 2  f t 0  h, w0  k1h
 f 0  0.4,0  1000  0.4
 f 0.4,400
 1000  3  400
 200
08.02.1
08.02.2
Chapter 08.02
1 
1
w1  w0   k1  k 2 h
2 
2
 1

1

 0    1000   200  0.4 
2

 2

 0  500  100  0.4
 160 rad/s
w1 is the approximate speed of the motor at
t  t1  t 0  h  0  0.4  0.4 s
w0.4  w1  160 rad/s
For i  1, t1  t 0  h  0  0.4  0.4, w1  160
k1  f t1 , w1 
 f 0.4, 160
 1000  3 160
 520
k 2 f t1  h, w1  k1h
 f 0.4  0.4, 160  520  0.4
 f 0.8, 368
 1000  3  368
 104
1 
1
w2  w1   k1  k 2 h
2 
2
1
1

 160   520   104  0.4
2
2

 160  208  0.4
 243.2 rad/s
w2 is the approximate speed of the motor at
t  t 2  t1  h  0.4  0.4  0.8 s
w0.8  w2  243.2 rad/s
The exact solution of the ordinary differential equation is given by
 1000   1000   3t
wt   

e
 3   3 
The solution to this nonlinear equation at t  0.8 s is
w0.8  303.09 rad/s
The results from Heun’s method are compared with exact results in Figure 1.
Euler Method for ODE-More Examples: Industrial Engineering
08.02.3
Figure 1 Heun’s method results for different step sizes.
Using smaller step size would increases the accuracy of the result as given in Table 1 and
Figure 2 below.
Table 1 Effect of step size for Heun’s method.
Et
Step size, h w0.8
t %
0.8
0.4
0.2
0.1
0.05
160.00
243.20
295.61
301.70
302.79
463.09
59.894
7.4823
1.3929
0.30613
152.79
19.761
2.4687
0.45954
0.10100
08.02.4
Chapter 08.02
Figure 2 Effect of step size in Heun’s method.
In Table 2, the Euler’s method and Runge-Kutta 2nd order method results are shown as a
function of step size.
Table 2 Comparison of Euler and the Runge-Kutta methods.
Step size,
w0.8
h
Euler
Heun
Midpoint
Ralston
0.8
800
160.00 160.00
160.00
0.4
320
243.20
243.20
243.20
0.2
324.8
295.61
295.61
295.61
0.1
314.11
301.70
301.70
301.70
0.05
308.58
302.79
302.79
302.79
In Figure 3, the comparison is shown over the range of time.
Euler Method for ODE-More Examples: Industrial Engineering
08.02.5
Figure 3 Comparison of Euler and Runge-Kutta methods with exact results over time
(h=0.4).
Download