Main Content

Solve nonstiff differential equations — high order method

`[`

,
where `t`

,`y`

] =
ode78(`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 use similar syntaxes. The `ode23s`

solver
can solve problems with a mass matrix only 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`

]
= ode78(`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 is significant. Do this by setting the
`'Events'`

option of `odeset`

to a function, such as
`myEventFcn`

or `@myEventFcn`

, and create 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`

= ode78(___)`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.

`ode78`

is an implementation of Verner's "most efficient" Runge-Kutta
8(7) pair with a 7th-order continuous extension. The solution is advanced with the 8th-order
result. The 7th-order continuous extension requires four additional evaluations of
`odefun`

, but only on steps that require interpolation.

[1] Verner, J. H. “Numerically Optimal
Runge–Kutta Pairs with Interpolants.” *Numerical Algorithms*
53, no. 2–3 (March 2010): 383–396. https://doi.org/10.1007/s11075-009-9290-3.