Integration Methods

10
Integration Methods Euler Runge-Kutta 2 Runge-Kutta 4

description

Integration Methods. Euler Runge-Kutta 2 Runge-Kutta 4. Euler’s Method. Let Stock = X Let flow = f(t, X) [function of time, Stock] Compute X(t) from X(t-dt) and time. X = dt * f (t-dt, X(t-dt)) X(t) = X(t-dt) + X. Euler’s Method. Assume flow = f(t). Like Riemann sum. - PowerPoint PPT Presentation

Transcript of Integration Methods

Page 1: Integration Methods

Integration Methods

EulerRunge-Kutta 2Runge-Kutta 4

Page 2: Integration Methods

Euler’s Method

Let Stock = XLet flow = f(t, X)[function of time, Stock]Compute X(t) from X(t-dt) and time. X = dt * f (t-dt, X(t-dt)) X(t) = X(t-dt) + X

Page 3: Integration Methods

Euler’s Method Assume flow = f(t).

Like Riemann sum.

X

X = d t * f(t-d t)

t-d t t

f(t-d t)

flo w = f(t)

d t

X

Page 4: Integration Methods

Euler Integration Error

Error = X - area under flow curve

XError =

Page 5: Integration Methods

Runge-Kutta 2

Let Stock = X, flow = f(t,X)Estimates for stock updates: F1 = dt * f(t-dt, X(t-dt)) F2 = dt * f(t, X(t-dt) + F1)

X = ½ * (F1 + F2)X(t) = X(t-dt) + X

Page 6: Integration Methods

Runge-Kutta 2 Assume flow = f(t).

Like Trapezoid Method.t-d t t

f(t-d t)

flo w = f(t)

d t

f(t)

F1F2

X

Page 7: Integration Methods

RK2 Integration Error

Error = X - area under flow curve

Error = X

Page 8: Integration Methods

Runge-Kutta 4

Let Stock = X, flow = f(t,X)Estimates for stock updates: F1 = dt * f(t-dt, X(t-dt)) F2 = dt * f(t-½dt, X(t-dt) + ½*F1) F3 = dt * f(t-½dt, X(t-dt) + ½*F2) F4 = dt * f(t, X(t-dt) + F3)

X = 1/6 * (F1+2*F2+2*F3+F4)X(t) = X(t-dt) + X

Page 9: Integration Methods

Runge-Kutta 4 Assume flow = f(t).

t-d t t

f(t-d t)

flo w = f(t)f(t)

F1F2 F3 F4

f(t-d t/2)

t-d t/2

X

Like Simpson’s Method.

Page 10: Integration Methods

What Method to Use?

RK2 and RK4 are more accurate for same dt than EulerRK2 and RK4 work well for continuous systemsEuler works poorly for oscillatory systems

RK2 and RK4 work poorly with logic values and integersRK2 and RK4 work poorly with discrete systemsRK2 and RK4 work poorly with conveyors