ode15s

Variable-order solver for stiff differential equations and index-1 algebraic systems.

Category: Mathematics > Numerical Integration and Differential Equations

Syntax

[t, y] = ode15s(odefun, tspan, y0)

Integrates y' = odefun(t, y) over tspan.

[t, y] = ode15s(odefun, tspan, y0, options)

Also applies options from odeset, such as 'Mass' or 'Jacobian'.

sol = ode15s(___)

Returns a structure for use with deval.

Description

A problem is stiff when the solution varies slowly but the equation has fast-decaying modes that force explicit methods to take tiny steps. ode15s uses implicit formulas (numerical differentiation formulas or backward differentiation formulas), which stay stable with large steps at the cost of solving equations at each step.

It is the first solver to try on a stiff problem. Supplying the Jacobian with odeset speeds it up.

Input arguments

odefun
Handle dydt = odefun(t, y) returning a column vector.
tspan
[t0 tf] or a vector of output times.
y0
Vector of initial values.
options
Structure from odeset. A mass matrix M(t)*y' = f(t, y) is given through 'Mass'.

Output arguments

t, y
Time points and solution, laid out as for ode45.

Example

A stiff decay

f = @(t, y) -1000*(y - cos(t));
[t, y] = ode15s(f, [0 1], 0);
fprintf('%.4f\n', y(end))
Output
0.5411

See also

ode45 ode23s ode15i odeset deval