10.07.2015 Views

Numerical Methods Library for OCTAVE

Numerical Methods Library for OCTAVE

Numerical Methods Library for OCTAVE

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.8.1 Euler[TT,Y] = ODE_EULER(ODEFUN,TSPAN,Y,NH) with TSPAN = [T0, TF] integrates thesystem of differential equations Y’=f(T,Y) from time T0 to TF with initialcondition Y0 using the <strong>for</strong>ward Euler method on an equispaced grid of NH intervals.Function ODEFUN(T,Y) must return a column vector corresponding to f(T, Y).Each row in the solution array Y corresponds to a time returned in the columnvector T.ParametersODEFUN integrated function.TSPAN TSPAN = [T0 TF]Y initial value Y(T0).NH TT equispaced grid of NH intervals.ReturnsTT equispaced grid of NH intervals.Y solution array.3.8.2 Implicit Euler[TT,Y] = ODE_BEULER(ODEFUN,TSPAN,Y,NH) with TSPAN = [T0, TF] integrates thesystem of differential equations Y’=f(T,Y) from time T0 to TF with initialcondition Y0 using the backward Euler method on an equispaced grid of NHintervals. Function ODEFUN(T, Y) must return a column vector correspondingto f(T, Y). Each row in the solution array Y corresponds to a time returnedin the column vector T.ParametersODEFUN integrated function.TSPAN TSPAN = [T0 TF].Y initial value Y(T0).NH TT equispaced grid of NH intervals.ReturnsTT equispaced grid of NH intervals.Y solution array.Euler’s method bases its projection on the derivative at the current point, and the resultinglarge value causes the numerical solution to diverge radically from the desired solution. Thisbehavior should not surprise us. The Jacobian <strong>for</strong> this equation is J = 100, so the stabilitycondition <strong>for</strong> Euler’s method requires a stepsize h < 0.02, which we are violating.By contrast, the backward Euler method has no trouble solving this problem. In fact, thebackward Euler solution is extremely insensitive to the initial value.21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!