ddesd

Solves delay differential equations with time- or state-dependent delays.

Category: Mathematics > Numerical Integration and Differential Equations

Syntax

sol = ddesd(ddefun, delay, history, tspan)

Solves y'(t) = ddefun(t, y, Z) where Z holds y evaluated at the delayed times given by delay.

sol = ddesd(ddefun, delay, history, tspan, options)

Also applies options from ddeset.

Description

ddesd generalizes dde23 by letting the delay depend on time and on the current state, as in models where the delay is itself a physical variable. The price is a more general, somewhat slower algorithm.

For constant delays, dde23 is usually the better choice.

Input arguments

ddefun
Handle dydt = ddefun(t, y, Z).
delay
Constant delay, a vector of constants, or a function d = delay(t, y) returning the delays.
history
Constant vector or function giving the solution for t <= t0.
tspan
Interval [t0 tf].

Output arguments

sol
Structure with sol.x, sol.y, usable with deval.

Example

Constant delay of 1

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

See also

dde23 ddensd ddeset deval