MATLAB Simulation Numerical Integration Dr. I.Fletcher School of Computing & Technology University of Sunderland
Why Integrate ? Within continuous-time simulation the use of Differential Equation Models is predominant. As simulation requires the solving of such equations then the inverse operator to the derivative function is required, Integration.
What is Integration ? time y(t) = f(t) The Area under the Curve !
How is it performed ? time f(t)f(t+h) h y(t) = f(t) y(t)
Via the Taylor Series expansion : the derivative over the integration time step can be shown to be which involves the evaluation of an infinite number of differential coefficients at each time step. Taylor Series
Euler Integration The simplest of all approaches it involves the truncation of the previously derived Taylor series to the 1st derivative, i.e.
Euler Schematic time y(t) y(t+h) h (dt) y(t) = f(t) dy(t)/dt dy(t)
Euler Implementation Procedure Step 1 :Evaluate the derivative(s) numerically from the conditions at the start of the integration time step and system constants. Step 2 :Solve the derivative(s) using the Euler equation Step 3 :Repeat steps 1 & 2 until the simulation end time, tend, is reached
Example : Series RC LPF Consider the RC LPF network and assume that RC = 1 second and that the output is initially zero volts ( that is the capacitor is initially uncharged ), then By using an integration time step of 0.1 seconds the systems response to a unit step can be calculated via
Example : Series RC LPF TimeVin (t)Vo (t)dVo (t)/dt 01[0]1 - 0 = *1 = = Etc… Unit Step
Example 1 : Series RC LPF time Output Voltage h = 1 h = 0.5 h = 0.2 h = 0.1 Actual Key :
Euler-Cauchy Integration time y(t)y(t+h) h y(t) = f(t) y e (t) t t+h t+h/2 dy(t)/dt dy e (t)/dt Equivalent to Truncation of Taylor Series to the second derivative !
Euler – Cauchy Procedure Step 1 : Evaluate the derivative(s) numerically from the conditions at the start of the integration time step and system constants. Step 2 : Solve the derivative(s) using the Euler equation to obtain the first estimate of the output(s) Step 3 : Use this estimate of the output(s) to re-determine the derivative(s) from the original equations Step 4 : Evaluate the next output(s) via the equation Step 5 : Repeat the above steps until the simulation end time
Example : Series RC LPF t = 0 : Vo(0) = [0], t = 0.1 : dVo(0) = 1 – [0] = 1, Ve (1) = [0] + 0.1*1 = 0.1, dVe(1) = = 0.9, Vo (1) = [0]+0.1(1+0.9)/2 = t = 0.2 : dVo(0) = = 0.905, Ve (1) = *0.905 = , dVe (1) = = , Vo (1) = ( )/2 = etc....
Euler-Cauchy Accuracy time Simulation Error Euler-Cauchy Euler h = 0.1 h = 0.2 h = 0.5 h = 0.1 h = 0.2 h = 0.5
In Conclusion Numerical Integration requires the following decisions to be made to achieve the best accuracy/simulation time trade off : Time Step Selection : Too small large simulation time/memory To LargeInaccuracy/possible instability Integration Method : Low orderGreater Errors High OrderComputational Effort