Mathematics 
Solving DDE Problems
This section uses an example to describe:
dde23
to solve initial value problems (IVPs) for delay differential equations (DDEs)
Example: A Straightforward Problem
This example illustrates the straightforward formulation, computation, and display of the solution of a system of DDEs with constant delays. The history is constant, which is often the case. The differential equations are
The example solves the equations on [0,5] with history
Note
The demo ddex1 contains the complete code for this example. To see the code in an editor, click the example name, or type edit ddex1 at the command line. To run the example type ddex1 at the command line. See DDE Solver Basic Syntax for more information.

dde23
, you must rewrite the equations as an equivalent system of firstorder differential equations. Do this just as you would when solving IVPs and BVPs for ODEs (see Solving ODE Problems). However, this example needs no such preparation because it already has the form of a firstorder system of equations.
dde23
as a vector. For the example we could use
dde23
can use.
dde23
with the functions ddex1de
and ddex1hist
.
dde23
by
dde23
returns the mesh it selects and the solution there as fields in the solution structure sol
. Often, these provide a smooth graph.
Evaluating the Solution at Specific Points
The method implemented in dde23
produces a continuous solution over the whole interval of integration . You can evaluate the approximate solution, , at any point in using the helper function deval
and the structure sol
returned by dde23
.
The deval
function is vectorized. For a vector tint
, the i
th column of Sint
approximates the solution .
Using the output sol
from the previous example, this code evaluates the numerical solution at 100 equally spaced points in the interval [0,5] and plots the result.
DDE Solver  Discontinuities 