Solve stiff differential equations — trapezoidal rule + backward differentiation formula

```
[t,y] =
ode23tb(odefun,tspan,y0)
```

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

```
[t,y,te,ye,ie]
= ode23tb(odefun,tspan,y0,options)
```

`sol = ode23tb(___)`

`[`

,
where `t`

,`y`

] =
ode23tb(`odefun`

,`tspan`

,`y0`

)`tspan = [t0 tf]`

, integrates the system of
differential equations $$y\text{'}=f\left(t,y\right)$$ from `t0`

to `tf`

with
initial conditions `y0`

. Each row in the solution
array `y`

corresponds to a value returned in column
vector `t`

.

All MATLAB^{®} ODE solvers can solve systems of equations of
the form $$y\text{'}=f\left(t,y\right)$$,
or problems that involve a mass matrix, $$M\left(t,y\right)y\text{'}=f\left(t,y\right)$$.
The solvers all use similar syntaxes. The `ode23s`

solver
only can solve problems with a mass matrix if the mass matrix is constant. `ode15s`

and `ode23t`

can
solve problems with a mass matrix that is singular, known as differential-algebraic
equations (DAEs). Specify the mass matrix using the `Mass`

option
of `odeset`

.

`[`

additionally
finds where functions of (`t`

,`y`

,`te`

,`ye`

,`ie`

]
= ode23tb(`odefun`

,`tspan`

,`y0`

,`options`

)*t*,*y*),
called event functions, are zero. In the output, `te`

is
the time of the event, `ye`

is the solution at the
time of the event, and `ie`

is the index of the triggered
event.

For each event function, specify whether the integration is
to terminate at a zero and whether the direction of the zero crossing
matters. Do this by setting the `'Events'`

property
to a function, such as `myEventFcn`

or `@myEventFcn`

,
and creating a corresponding function: [`value`

,`isterminal`

,`direction`

]
= `myEventFcn`

(`t`

,`y`

).
For more information, see ODE Event Location.

returns
a structure that you can use with `sol`

= ode23tb(___)`deval`

to evaluate
the solution at any point on the interval `[t0 tf]`

.
You can use any of the input argument combinations in previous syntaxes.

`ode23tb`

is an implementation of TR-BDF2,
an implicit Runge-Kutta formula with a trapezoidal rule step as its
first stage and a backward differentiation formula of order two as
its second stage. By construction, the same iteration matrix is used
in evaluating both stages. Like `ode23s`

and `ode23t`

,
this solver may be more efficient than `ode15s`

for
problems with crude tolerances [1], [2].

[1] Bank, R. E., W. C. Coughran, Jr., W. Fichtner,
E. Grosse, D. Rose, and R. Smith, “Transient
Simulation of Silicon Devices and Circuits,” *IEEE
Trans. CAD*, 4 (1985), pp. 436–451.

[2] Shampine, L. F. and M. E. Hosea, “Analysis
and Implementation of TR-BDF2,” *Applied Numerical
Mathematics 20*, 1996.