Skip to content

deval

ode · scripts/ode/deval.m

: y = deval (sol, xq)
: y = deval (xq, sol)
: y = deval (sol, xq, idx)
: [y, yp] = deval (…)

Evaluate an ODE solution structure at the query times xq.

sol is the structure returned by ode45, ode113 and the other initial-value solvers: x holds the mesh and each column of y is the state at that mesh point. The two-argument form also accepts the arguments in the opposite order. idx selects state components (rows of sol.y).

The interpolant is the cubic Hermite polynomial matching the stored state and, when sol.idata.yp is present, the stored derivative. Otherwise a cubic spline of the mesh values is used. A second output is the derivative of that interpolant. Query times outside [sol.x(1), sol.x(end)] are an error.