MIT2_017JF09_p13

MIT2_017JF09_p13 - 13 NUMERICAL SOLUTION OF ODES 13 28...

This preview shows pages 1–2. Sign up to view the full content.

13 NUMERICAL SOLUTION OF ODE’S 28 13 Numerical Solution of ODE’s In simulating dynamical systems, we frequently solve ordinary diﬀerential equations. These are of the form dx = f ( t,x ) , dt where the function f has as arguments both time and the state x . The time argument is used if the system is time-dependent (time-varying), but unnecessary if the system is time-invariant. Solving the diﬀerential equation means propagating x forward in time from some initial condition, say x ( t = 0), and typically the solution will be given as a vector of [ x (0) ,x t ) ,x (2Δ t ) , ··· ], where Δ t is a ﬁxed time step. The Taylor series is used to derive most of the simple formulas for solving ODE’s. The general Taylor series expansion of the generic function g in two variables is g ( t + Δ t,x + Δ x ) = g ( t,x ) + ∂g ∂t Δ t + ∂g ∂x Δ x + 1 2! 2 g ∂t 2 Δ t 2 + 1 2! 2 g ∂t∂x Δ t Δ x + 1 2! 2 g ∂x∂t Δ x Δ t + 1 2! 2 g ∂x 2 Δ x 2 + ··· . In the above formula, when the arguments of g and its derivatives are not shown, we mean that it is to be evaluated at ( t,x ), that is g alone means g ( t,x ) and so on. We use this shorthand below in several places. The simplest of all the ODE methods is forward Euler , created by setting g = x and looking only at the ﬁrst two terms on the right-hand side of the Taylor series: x ( t + Δ t ) = x ( t ) + dx dt Δ t = x ( t ) + Δ tf This formula says that x at the next time instant is the current x plus the time step times the slope evaluated at the current x . Referring to the Taylor series, we see that the forward Euler does not do anything with the second-order terms (Δ t 2 and beyond), and so we say the method is second-order accurate in the step, which will turn out to be ﬁrst-order accurate when you solve a real problem with many steps. First-order means that if you halve the time step, you can expect about half the error in the overall simulation. An alternative, the Runge-Kutta methods are popular workhorses, and implemented in the MATLAB commands ode23() and ode45() . Let’s take a look at the ﬁrst of these: The rule is k 1 = Δ tf k 2 = Δ tf ( t + Δ t/ 2 ,x ( t ) + k 1 / 2) x ( t + Δ t ) = x ( t ) + k 2 We see that k 1 is the same change in

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 8

MIT2_017JF09_p13 - 13 NUMERICAL SOLUTION OF ODES 13 28...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online