15.11.2014 Views

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

MATLAB Mathematics - SERC - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5 Differential Equations<br />

1<br />

Robertson DAE problem with a Conservation Law, solved by ODE15S<br />

0.9<br />

0.8<br />

0.7<br />

0.6<br />

1e4 * y(:,2)<br />

0.5<br />

0.4<br />

0.3<br />

0.2<br />

0.1<br />

0<br />

10 −6 10 −4 10 −2 10 0 10 2 10 4 10 6 10 8<br />

This is equivalent to the stiff ODEs coded in HB1ODE.<br />

Example: Computing Nonnegative Solutions<br />

If certain components <strong>of</strong> the solution must be nonnegative, use odeset to set<br />

the NonNegative property for the indices <strong>of</strong> these components.<br />

Note This option is not available for ode23s, ode15i, and for implicit solvers<br />

(ode15s, ode23t, ode23tb) applied to problems where there is a mass matrix.<br />

Imposing nonnegativity is not always a trivial task. We suggest that you use<br />

this option only when necessary, for example in instances in which the<br />

application <strong>of</strong> a solution or integration will fail otherwise.<br />

Consider the following initial value problem solved on the interval [0, 40]:<br />

y' = - |y|, y(0) = 1<br />

The solution <strong>of</strong> this problem decays to zero. If a solver produces a negative<br />

approximate solution, it begins to track the solution <strong>of</strong> the ODE through this<br />

value, the solution goes <strong>of</strong>f to minus infinity, and the computation fails. Using<br />

the NonNegative property prevents this from happening.<br />

5-38

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

Saved successfully!

Ooh no, something went wrong!