| MATLAB Function Reference | ![]() |
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
dydt = ddefun(t,y,Z) where t corresponds to the current
| |
Function handle that returns a column vector of delays
If all the delay functions have the form
| |
Specify history in one of three ways:
| |
Interval of integration as a vector [t0,tf] with t0 < tf. | |
Optional integration argument. A structure you create using the ddeset function. See ddeset for details. |
sol = ddesd(ddefun,delays,history,tspan) integrates the system of DDEs
![]()
on the interval
, where delays
can depend on both
and
, and
. Inputs ddefun and delays are function handles.
See Function Handles in the MATLAB® Programming documentation for more information.
in the MATLAB Mathematics documentation, explains how to provide additional parameters to the functions ddefun, delays, and history, if necessary.
ddesd returns the solution as a structure sol. Use the auxiliary function deval and the output sol to evaluate the solution at specific points tint in the interval tspan = [t0,tf].
yint = deval(sol,tint)
The structure sol returned by ddesd has the following fields.
Mesh selected by ddesd | |
Approximation to
| |
Approximation to
| |
Solver name, 'ddesd' |
sol = ddesd(ddefun,delays,history,tspan,options) solves as above with default integration properties replaced by values in options, an argument created with ddeset. See ddeset and DDEs in the MATLAB documentation for details.
Commonly used options are scalar relative error tolerance 'RelTol' (1e-3 by default) and vector of absolute error tolerances 'AbsTol' (all components are 1e-6 by default).
Use the 'Events' option to specify a function
that ddesd 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 the kth event function in events:
value(k) is the value of the kth event function.
isterminal(k) = 1 if you want the integration to terminate at a zero of this event function and 0 otherwise.
direction(k) = 0 if you want ddesd to compute all zeros of this event function, +1 if only zeros where the event function increases, and -1 if only zeros where the event function decreases.
If you specify the 'Events' option and events are detected, the output structure sol also includes fields:
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 sol.xe | |
Vector containing indices that specify which event occurred at the corresponding time in sol.xe |
The equation
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
by the function ddex1hist.
The solution is evaluated at 100 equally spaced points in [0,5]:
tint = linspace(0,5); yint = deval(sol,tint);
and plotted with
plot(tint,yint);
This problem involves constant delays. The delay function 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]);
or using dde23:
sol = dde23(@ddex1de,delays,@ddex1hist,[0, 5]);
For more examples of solving delay differential equations see ddex2 and ddex3.
dde23, ddeget, ddeset, deval, function_handle (@)
[1] Shampine, L.F., "Solving ODEs and DDEs with Residual Control," Applied Numerical Mathematics, Vol. 52, 2005, pp. 113-127.
![]() | ddeget | ddeset | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |