# ode15s

Solve a system of stiff differential equations.

## Syntax

[t,y] = ode15s(@func,tin,y0)

[t,y] = ode15s(@func,tin,y0,options)

[t,y,te,ye,ie] = ode15s(...)

## Inputs

`func`- The system of equations to solve.
`tin`- The vector of times (or other domain variable) at which to report the solution. If the vector has two elements, then the solver operates in single-step mode and determines the appropriate intermediate steps.
`y0`- The vector of initial conditions.
`options`- A struct containing options settings specified via odeset.

## Outputs

- t
- The times at which the solution is computed.
- y
- The solution matrix, with the solution at each time stored by row.
- te
- The times at which the 'Events' function recorded a zero value.
- ye
- The system function values corresponding to each te value.
- ie
- The index of the event that recorded each zero value.

## Example

Solve the Van Der Pol oscillator. This example is not stiff, but becomes stiff for large
values of `mu`.

```
function dy = VDP(t,y,mu)
% y = [x, dx/dt]
dy = [0, 0];
dy(1) = y(2);
dy(2) = mu * (1.0 - y(1)^2) * y(2) - y(1);
end
mu = 1.0; % mass
handle = @(t,y) VDP(t,y,mu);
t = [0:0.2:10]; % time vector
yi = [2, 0];
[t,y] = ode15s(handle,t,yi);
x = y(:,1)'
```

```
x = [Matrix] 1 x 51
2.00000 1.96684 1.88770 1.78102 1.65390 1.50781 1.34081 1.14828 0.92255
0.65226 0.32198 -0.08498 -0.57355 -1.10232 -1.56568 -1.86407 -1.99079
-2.00144 -1.94697 -1.85570 -1.74078 -1.60680 -1.45352 -1.27806 -1.07511
-0.83578 -0.54694 -0.19174 0.24571 0.75830 1.28080 1.69564 1.92881 2.00712
1.99028 1.92071 1.82036 1.69860 1.55799 1.39755 1.21364 0.99951 0.74490
0.43561 0.05486 -0.40929 -0.93453 -1.43392 -1.79186 -1.96728 -2.00821
```

## Comments

ode15s solves the system using the backward differentiation formula algorithm from the Sundials CVODE library.

To pass additional parameters to a function argument, use an anonymous function.

The odeset options and defaults are as follows.

- RelTol: 1.0e-3
- AbsTol: 1.0e-6
- Jacobian: []

The 'Events' function used with the last three output arguments is specified using odeset.