Solve delay differential equations (DDEs) with general delays
sol = ddesd(ddefun,delays,history,tspan)
sol = ddesd(ddefun,delays,history,tspan,options)
Function handle that evaluates the right side of the differential equations y′(t) = f(t,y(t),y(d(1),...,y(d(k))). The function must have the form
dydt = ddefun(t,y,Z)
Function handle that returns a column vector of delays d(j).
The delays can depend on both t and y(t).
all the delay functions have the form d(j) = t – τj, you
can set the argument
Interval of integration from
Optional integration argument. A structure you create
sol = ddesd(ddefun,delays,history,tspan) integrates
the system of DDEs
on the interval [t0,tf],
where delays d(j) can depend
on both t and y(t),
and t0 < tf.
function handles. See Create Function Handle for more information.
Parameterizing Functions explains how to provide additional
parameters to the functions
history, if necessary.
ddesd returns the solution as a structure
Use the auxiliary function
sol to evaluate the solution at specific
tint in the interval
tspan = [t0,tf].
yint = deval(sol,tint)
sol returned by
the following fields.
Mesh selected by
Approximation to y(x)
at the mesh points in
Approximation to y′(x)
at the mesh points in
sol = ddesd(ddefun,delays,history,tspan,options) solves
as above with default integration properties replaced by values in
an argument created with
ddeset and Solving Delay Differential Equations for
Commonly used options are scalar relative error tolerance
default) and vector of absolute error tolerances
1e-6 by default).
'Events' option to specify a function
ddesd calls to find where functions g(t,y(t),y(d(1)),...,y(d(k)))
vanish. This function must be of the form
[value,isterminal,direction] = events(t,y,Z)
and contain an event function for each event to be tested. For
kth event function in
value(k) is the value of the
isterminal(k) = 1 if you want the
integration to terminate at a zero of this event function and
direction(k) = 0 if you want
compute all zeros of this event function,
only zeros where the event function increases, and
only zeros where the event function decreases.
If you specify the
and events are detected, the output structure
Row vector of locations of all events, i.e., times when an event function vanished
Matrix whose columns are the solution values corresponding
to times in
Vector containing indices that specify which event occurred
at the corresponding time in
sol = ddesd(@ddex1de,@ddex1delays,@ddex1hist,[0,5]);
solves a DDE on the interval
[0,5] with delays
specified by the function
ddex1delays and differential
equations computed by
ddex1de. The history is evaluated
for t ≤ 0 by the function
The solution is evaluated at 100 equally spaced points in
tint = linspace(0,5); yint = deval(sol,tint);
and plotted with
This problem involves constant delays. The
has the form
function d = ddex1delays(t,y) %DDEX1DELAYS Delays for using with DDEX1DE. d = [ t - 1 t - 0.2];
The problem can also be solved with the syntax corresponding to constant delays
delays = [1, 0.2]; sol = ddesd(@ddex1de,delays,@ddex1hist,[0, 5]);
sol = dde23(@ddex1de,delays,@ddex1hist,[0, 5]);
 Shampine, L.F., “Solving ODEs and DDEs with Residual Control,” Applied Numerical Mathematics, Vol. 52, 2005, pp. 113-127.