Chapter 08.02 Euler’s Method for Ordinary Differential EquationsMore 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 dvt 1 dt 150 10 6 18 cos120 t 2 vt ,0 0.1 max 0.04 v(0) 0 Using Euler’s method, find the voltage across the capacitor at t 0.00004 s . Use step size h 0.00002 s . Solution dv 1 dt 150 10 6 18 cos120 t 2 v ,0 0.1 max 0.04 18 cos120 t 2 v ,0 0.1 max 0.04 The Euler’s method reduces to vi 1 vi f t i , vi h For i 0 , t 0 0 , v0 0 v1 v0 f t 0 , v0 h f t , v 1 150 10 6 0 f 0,00.00002 18 cos120 0 2 0 ,0 0.00002 0.1 max 0.04 6 0 2.666 10 0.00002 53.320 V 1 150 10 6 08.02.1 08.02.2 Chapter 08.02 v1 is the approximate voltage at t t1 t 0 h 0 0.00002 0.00002 s v0.00002 v1 53.320 V For i 1, t1 0.00002 , v1 53.320 v2 v1 f t1 , v1 h 53.320 f 0.00002,53.3200.00002 18 cos120 0.00002 2 53.320 1 53.320 0.1 max ,0 0.00002 6 0.04 150 10 53.320 0.0000150000.00002 53.307 V v2 is the approximate voltage at t t 2 t1 h 0.00002 0.00002 0.00004 s v0.00004 v2 53.307 V Figure 1 compares the exact solution of v(0.00004) 15.974 V with the numerical solution from Euler’s method for the step size of h 0.00004 s . Figure 1 Comparing exact and Euler’s method. Euler Method for ODE-More Examples: Computer Engineering 08.02.3 The problem was solved again using smaller step sizes. The results are given below in Table 1. Table 1 Voltage at 0.00004 seconds as a function of step size, h . Step size, h v0.00004 0.00004 0.00002 0.00001 0.000005 0.0000025 106.64 53.307 26.640 15.996 15.993 Et |t | % 90.667 37.333 10.666 0.021991 0.019125 567.59 233.71 66.771 0.13766 0.11972 Figure 2 shows how the voltage varies as a function of time for different step sizes. Figure 2 Comparison of Euler’s method with exact solution for different step sizes. While the values of the calculated voltage at t 0.00004 s as a function of step size are plotted in Figure 3. 08.02.4 Chapter 08.02 Figure 3 Effect of step size in Euler’s method.