Chapter 08.04 Differential Equations-More Examples Industrial Engineering

advertisement
Chapter 08.04
Runge-Kutta 4th Order Method for
Differential Equations-More Examples
Industrial Engineering
Ordinary
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 w0  0 ,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 .
Solution
dw
 1000  3w
dt
f t,w  1000  3w
1
wi 1  wi  k1  2k 2  2k 3  k 4 h
6
For i  0 , t 0  0 , w0  0
k1  f t 0 , w0 
 f 0,0
 1000  3  0
 1000
1
1


k 2  f  t 0  h, w0  k1 h 
2
2



1

1

 f  0    0.4 , 0   1000  0.4  
2

2


 f 0.2,200
 1000  3  200
 400
1
1


k 3  f  t 0  h, w0  k 2 h 
2
2


08.04.1
08.04.2
Chapter 08.04

1

1

 f  0    0.4 , 0   400  0.4  
2

2


 f 0.2, 80
 1000  3  80
 760
k 4  f t 0  h, w0  k 3 h
 f 0  0.4, 0  760  0.4
 f 0.4, 304
 1000  3  304
 88
1
w1  w0  ( k1  2k 2  2k 3  k 4 )h
6
1
 0  1000  2  400  2  760  88  0.4
6
1
 0  3408  0.4
6
 227.2 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  227.2 rad/s
For i  1, t1  0.4, w1  227.2
k1  f t1 , w1 
 f 0.4, 227.2
 1000  3  227.2
 318.4
1
1


k 2  f  t1  h, w1  k1 h 
2
2



1

1

 f  0.4    0.4 , 227.2   318.4  0.4  
2

2


 f 0.6, 290.88
 1000  3  290.88
 127.36
1
1


k 3  f  t1  h, w1  k 2 h 
2
2



1

1

 f  0.4    0.4 , 227.2   127.36  0.4  
2

2


 f 0.6, 252.67
 1000  3  252.67
 241.98
Runge-Kutta 4th Order Method for ODE-More Examples: Industrial Engineering
08.04.3
k 4  f t1  h, w1  k 3 h 
 f 0.4  0.4, 227.2  241.98  0.4
 f 0.8, 323.99
 1000  3  323.99
 28.019
1
w2  w1  k1  2k 2  2k 3  k 4 h
6
1
 227.2  318.4  2  127.36   2  241.98  28.019   0.4
6
1
 227.2  1085.1  0.4
6
 299.54 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  299.54 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
Figure 1 compares the exact solution with the numerical solution using the Runge-Kutta 4th
order method using different step sizes.
08.04.4
Chapter 08.04
Figure 1 Comparison of Runge-Kutta 4th 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 t  0.8 s .
Table 1 Values of speed of the motor at 0.8 seconds for different step sizes.
Step size, h
0.8
0.4
0.2
0.1
0.05
w0.8
147.20
299.54
302.96
303.09
303.09
Et
155.89
3.5535
0.12988
0.0062962
0.00034702
|t | %
51.434
1.1724
0.042852
0.0020773
0.00011449
Runge-Kutta 4th Order Method for ODE-More Examples: Industrial Engineering
08.04.5
Figure 2 Effect of step size in Runge-Kutta 4th order method.
In Figure 3, we are comparing the exact results with Euler’s method (Runge-Kutta 1st order
method), Heun’s method (Runge-Kutta 2nd order method) and the Runge-Kutta 4th order
method.
08.04.6
Chapter 08.04
Figure 3 Comparison of Runge-Kutta methods of 1st, 2nd, and 4th order.
Download