Presentation is loading. Please wait.

Presentation is loading. Please wait.

MATLAB Simulation Numerical Integration Dr. I.Fletcher School of Computing & Technology University of Sunderland.

Similar presentations


Presentation on theme: "MATLAB Simulation Numerical Integration Dr. I.Fletcher School of Computing & Technology University of Sunderland."— Presentation transcript:

1 MATLAB Simulation Numerical Integration Dr. I.Fletcher School of Computing & Technology University of Sunderland

2 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.

3 What is Integration ? time y(t) = f(t) The Area under the Curve !

4 How is it performed ? time f(t)f(t+h) h y(t) = f(t) y(t) 

5 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

6 Euler Integration The simplest of all approaches it involves the truncation of the previously derived Taylor series to the 1st derivative, i.e.

7 Euler Schematic time y(t) y(t+h) h (dt) y(t) = f(t) dy(t)/dt dy(t)

8 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

9 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

10 Example : Series RC LPF TimeVin (t)Vo (t)dVo (t)/dt 01[0]1 - 0 = 1 0.110 + 0.1*1 = 0.11 - 0.1 = 0.9 0.210.190.81 0.310.271Etc… Unit Step

11 Example 1 : Series RC LPF 00.511.522.533.54 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 time Output Voltage h = 1 h = 0.5 h = 0.2 h = 0.1 Actual Key :

12 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 !

13 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

14 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) = 1 - 0.1 = 0.9, Vo (1) = [0]+0.1(1+0.9)/2 = 0.095 t = 0.2 : dVo(0) = 1 - 0.095 = 0.905, Ve (1) = 0.095 + 0.1*0.905 = 0.1855, dVe (1) = 1 - 0.1855 = 0.8145, Vo (1) = 0.095+0.1(0.905+0.8145)/2 = 0.181 etc....

15 Euler-Cauchy Accuracy -0.12 -0.1 -0.08 -0.06 -0.04 -0.02 0 0.02 00.511.522.533.54 time Simulation Error Euler-Cauchy Euler h = 0.1 h = 0.2 h = 0.5 h = 0.1 h = 0.2 h = 0.5

16 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


Download ppt "MATLAB Simulation Numerical Integration Dr. I.Fletcher School of Computing & Technology University of Sunderland."

Similar presentations


Ads by Google