dde23

Solves delay differential equations with constant delays.

Category: Mathematics > Numerical Integration and Differential Equations

Syntax

sol = dde23(ddefun, lags, history, tspan)

Solves y'(t) = ddefun(t, y, Z), where column j of Z is y(t - lags(j)).

sol = dde23(ddefun, lags, history, tspan, options)

Also applies options from ddeset.

Description

A delay equation depends on the state at earlier times, so a whole history function, not just an initial value, is needed to start. The solver is a Runge-Kutta method with step control that also handles the derivative discontinuities that delays propagate.

For delays that depend on t or y, use ddesd; for neutral equations, ddensd.

Input arguments

ddefun
Handle dydt = ddefun(t, y, Z).
lags
Vector of positive constant delays.
history
Constant vector, or a function y = history(t), giving the solution for t <= t0.
tspan
Interval [t0 tf].

Output arguments

sol
Structure with sol.x, sol.y (one column per time) and sol.yp, usable with deval.

Example

y'(t) = -y(t-1), history 1

sol = dde23(@(t, y, Z) -Z, 1, 1, [0 2]);
fprintf('%.4f\n', sol.y(end))
Output
-0.5000

See also

ddesd ddensd ddeset deval ode45