Mathematics Previous page   Next Page

Solving DDE Problems

This section uses an example to describe:

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

for t less than or equal 0.

  1. Rewrite the problem as a first-order system. To use dde23, you must rewrite the equations as an equivalent system of first-order differential equations. Do this just as you would when solving IVPs and BVPs for ODEs (see Examples: Solving Explicit ODE Problems). However, this example needs no such preparation because it already has the form of a first-order system of equations.
  2. Identify the lags. The delays (lags) tau sub 1 through tau sub k are supplied to dde23 as a vector. For the example we could use
  1. In coding the differential equations, tau sub j = lags(j).

  1. Code the system of first-order DDEs. Once you represent the equations as a first-order system, and specify lags, you can code the equations as a function that dde23 can use.
  1. This code represents the system in the function, ddex1de.

  1. Code the history function. The history function for this example is
  2. Apply the DDE solver. The example now calls dde23 with the functions ddex1de and ddex1hist.
  1. Here the example supplies the interval of integration [0,5] directly. Because the history is constant, we could also call dde23 by

  1. View the results. Complete the example by displaying the results. 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 [t sub 0, t sub f]. You can evaluate the approximate solution, S(t), at any point in [t sub 0, t sub f] using the helper function deval and the structure sol returned by dde23.

The deval function is vectorized. For a vector tint, the ith column of Sint approximates the solution y(tint(i)).

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.

Previous page  DDE Solver Discontinuities Next page

© 1994-2005 The MathWorks, Inc.