Skip to content

ode45

ode · scripts/ode/ode45.m

: [t, y] = ode45 (fcn, tspan, y0)
: [t, y] = ode45 (fcn, tspan, y0, opts)
: [t, y, te, ye, ie] = ode45 (…)
: sol = ode45 (…)

Solve the non-stiff initial value problem y' = fcn (t, y), y(tspan(1)) = y0 with an adaptive fifth-order Dormand-Prince Runge-Kutta pair.

With two entries in tspan, the solver returns its own step points (four per step by default, see the Refine option); with more entries the solution is returned at exactly those times. A decreasing tspan integrates backwards. Options are set with odeset: RelTol, AbsTol, NormControl, InitialStep, MaxStep, Refine, Stats, OutputFcn, OutputSel, Events, NonNegative, Mass and MStateDependence.

With one output the result is a structure with the fields solver, extdata, x, y, stats and, when events are defined, xe, ye and ie.