ode78

Seventh- and eighth-order Runge-Kutta solver for nonstiff equations with tight tolerances.

Category: Mathematics > Numerical Integration and Differential Equations

Syntax

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

Integrates y' = odefun(t, y).

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

Also applies options from odeset.

Description

High-order Runge-Kutta formulas take large steps on smooth solutions and are efficient when the tolerances are strict, for example RelTol near 1e-10, as in orbit computations. The cost per step is higher than for ode45, so for crude tolerances ode45 can be faster.

It is for nonstiff problems only.

Input arguments

odefun
Handle dydt = odefun(t, y).
tspan
[t0 tf] or a vector of output times.
y0
Vector of initial values.

Output arguments

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

Example

Strict tolerance

opts = odeset('RelTol', 1e-10, 'AbsTol', 1e-12);
[t, y] = ode78(@(t, y) -y, [0 1], 1, opts);
fprintf('%.8f %.8f\n', y(end), exp(-1))
Output
0.36787944 0.36787944

See also

ode89 ode45 ode113 odeset