Solve delay differential equations (DDEs) with constant delays
sol = dde23(ddefun,lags,history,tspan)
sol = dde23(ddefun,lags,history,tspan,options)
Function handle that evaluates the right side of the differential equations . The function must have the form
dydt = ddefun(t,y,Z)
Vector of constant, positive delays τ1, ..., τk.
Interval of integration from
Optional integration argument. A structure you create
sol = dde23(ddefun,lags,history,tspan) integrates
the system of DDEs
on the interval [t0,tf],
where τ1, ..., τk are
constant, positive delays and t0,tf.
The input argument,
ddefun, is a function handle.
Parameterizing Functions explains how to provide additional
parameters to the function
ddefun, if necessary.
dde23 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 = dde23(ddefun,lags,history,tspan,options) solves
as above with default integration properties replaced by values in
an argument created with
ddeset and Types of DDEs for
Commonly used options are scalar relative error tolerance
default) and vector of absolute error tolerances
1e-6 by default).
'Jumps' option to solve problems
with discontinuities in the history or solution. Set this option to
a vector that contains the locations of discontinuities in the solution
t0 (the history) or in coefficients of
the equations at known values of t after
'Events' option to specify a function
dde23 calls to find where functions 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
'Events' option and events
are detected, the output structure
sol also includes
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
This example solves a DDE on the interval [0, 5] with lags 1
and 0.2. The function
ddex1de computes the delay
differential equations, and
the history for
t <= 0.
contains the complete code for this example. To see the code in an
edit ddex1 at the command line. To
run it, type
ddex1 at the command line.
sol = dde23(@ddex1de,[1, 0.2],@ddex1hist,[0, 5]);
This code evaluates the solution at 100 equally spaced points
in the interval
[0,5], then plots the result.
tint = linspace(0,5); yint = deval(sol,tint); plot(tint,yint);
ddex1 shows how you can code this problem
using local functions. For more examples see
dde23 tracks discontinuities and integrates
with the explicit Runge-Kutta (2,3) pair and interpolant of
It uses iteration to take steps longer than the lags.
 Shampine, L.F. and S. Thompson, “Solving DDEs in MATLAB,” Applied Numerical Mathematics, Vol. 37, 2001, pp. 441-458.
 Kierzenka, J., L.F. Shampine, and S. Thompson, “Solving Delay Differential Equations with dde23”