This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.


Create or alter delay differential equations options structure


options = ddeset('name1',value1,'name2',value2,...)
options = ddeset(oldopts,'name1',value1,...)
options = ddeset(oldopts,newopts)


options = ddeset('name1',value1,'name2',value2,...) creates an integrator options structure options in which the named properties have the specified values. Any unspecified properties have default values. It is sufficient to type only the leading characters that uniquely identify the property. ddeset ignores case for property names.

options = ddeset(oldopts,'name1',value1,...) alters an existing options structure oldopts. This overwrites any values in oldopts that are specified using name/value pairs and returns the modified structure as the output argument.

options = ddeset(oldopts,newopts) combines an existing options structure oldopts with a new options structure newopts. Any values set in newopts overwrite the corresponding values in oldopts.

ddeset with no input arguments displays all property names and their possible values, indicating defaults with braces {}.

You can use the function ddeget to query the options structure for the value of a specific property.

DDE Properties

The following sections describe the properties that you can set using ddeset. There are several categories of properties:

Error Control Properties

At each step, the DDE solvers estimate an error e. The dde23 function estimates the local truncation error, and the other solvers estimate the residual. In either case, this error must be less than or equal to the acceptable error, which is a function of the specified relative tolerance, RelTol, and the specified absolute tolerance, AbsTol.


For routine problems, the solvers deliver accuracy roughly equivalent to the accuracy you request. They deliver less accuracy for problems integrated over "long" intervals and problems that are moderately unstable. Difficult problems may require tighter tolerances than the default values. For relative accuracy, adjust RelTol. For the absolute error tolerance, the scaling of the solution components is important: if |y| is somewhat smaller than AbsTol, the solver is not constrained to obtain any correct digits in y. You might have to solve a problem more than once to discover the scale of solution components.

Roughly speaking, this means that you want RelTol correct digits in all solution components except those smaller than thresholds AbsTol(i). Even if you are not interested in a component y(i) when it is small, you may have to specify AbsTol(i) small enough to get some correct digits in y(i) so that you can accurately compute more interesting components.

The following table describes the error control properties.

DDE Error Control Properties





Positive scalar {1e-3}

A relative error tolerance that applies to all components of the solution vector y. It is a measure of the error relative to the size of each solution component. Roughly, it controls the number of correct digits in all solution components except those smaller than thresholds AbsTol(i). The default, 1e-3, corresponds to 0.1% accuracy.

The estimated error in each integration step satisfies |e(i)|max(RelTol*abs(y(i)),AbsTol(i)).


Positive scalar or vector {1e-6}

Absolute error tolerances that apply to the individual components of the solution vector. AbsTol(i) is a threshold below which the value of the ith solution component is unimportant. The absolute error tolerances determine the accuracy when the solution approaches zero. Even if you are not interested in a component y(i) when it is small, you may have to specify AbsTol(i) small enough to get some correct digits in y(i) so that you can accurately compute more interesting components.

If AbsTol is a vector, the length of AbsTol must be the same as the length of the solution vector y. If AbsTol is a scalar, the value applies to all components of y.


on | {off}

Control error relative to norm of solution. Set this property on to request that the solvers control the error in each integration step with norm(e)<= max(RelTol*norm(y),AbsTol). By default, the solvers use a more stringent component-wise error control.

Solver Output Properties

You can use the solver output properties to control the output that the solvers generate.

DDE Solver Output Properties





Function handle {@odeplot}

The output function is a function that the solver calls after every successful integration step. To specify an output function, set 'OutputFcn' to a function handle. For example,

options = ddeset('OutputFcn',...

sets 'OutputFcn' to @myfun, a handle to the function myfun. See Create Function Handle for more information.

The output function must be of the form

status = myfun(t,y,flag)

Parameterizing Functions explains how to provide additional parameters to myfun, if necessary.

The solver calls the specified output function with the following flags. Note that the syntax of the call differs with the flag. The function must respond appropriately:

  • init — The solver calls myfun(tspan,y0,'init') before beginning the integration to allow the output function to initialize. tspan is the input argument to the solvers. y0 is the initial value of the solution, either from history(t0) or specified in the initialY option.

  • {none} — The solver calls status = myfun(t,y) after each integration step on which output is requested. t contains points where output was generated during the step, and y is the numerical solution at the points in t. If t is a vector, the ith column of y corresponds to the ith element of t.

    myfun must return a status output value of 0 or 1. If status = 1, the solver halts integration. You can use this mechanism, for instance, to implement a Stop button.

  • done — The solver calls myfun([],[],'done') when integration is complete to allow the output function to perform any cleanup chores.

You can use these general purpose output functions or you can edit them to create your own. Type help functionname at the command line for more information.

  • odeplot – time series plotting (default when you call the solver with no output argument and you have not specified an output function)

  • odephas2 – two-dimensional phase plane plotting

  • odephas3 – three-dimensional phase plane plotting

  • odeprint – print solution as the solver computes it


Vector of indices

Vector of indices specifying which components of the solution vector the solvers pass to the output function. For example, if you want to use the odeplot output function, but you want to plot only the first and third components of the solution, you can do this using

options = ddeset...
'OutputSel',[1 3]);

By default, the solver passes all components of the solution to the output function.


on | {off}

Specifies whether the solver should display statistics about its computations. By default, Stats is off. If it is on, after solving the problem the solver displays:

  • The number of successful steps

  • The number of failed attempts

  • The number of times the DDE function was called

Step Size Properties

The step size properties let you specify the size of the first step the solver tries, potentially helping it to better recognize the scale of the problem. In addition, you can specify bounds on the sizes of subsequent time steps.

The following table describes the step size properties.

DDE Step Size Properties





Positive scalar

Suggested initial step size. InitialStep sets an upper bound on the magnitude of the first step size the solver tries. If you do not set InitialStep, the solver bases the initial step size on the slope of the solution at the initial time tspan(1). The initial step size is limited by the shortest delay. If the slope of all solution components is zero, the procedure might try a step size that is much too large. If you know this is happening or you want to be sure that the solver resolves important behavior at the start of the integration, help the code start by providing a suitable InitialStep.


Positive scalar

Upper bound on solver step size. If the differential equation has periodic coefficients or solutions, it may be a good idea to set MaxStep to some fraction (such as 1/4) of the period. This guarantees that the solver does not enlarge the time step too much and step over a period of interest. Do not reduce MaxStep:

  • When the solution does not appear to be accurate enough. Instead, reduce the relative error tolerance RelTol, and use the solution you just computed to determine appropriate values for the absolute error tolerance vector AbsTol. (See Error Control Properties for a description of the error tolerance properties.)

  • To make sure that the solver doesn't step over some behavior that occurs only once during the simulation interval. If you know the time at which the change occurs, break the simulation interval into two pieces and call the solver twice. If you do not know the time at which the change occurs, try reducing the error tolerances RelTol and AbsTol. Use MaxStep as a last resort.

Event Location Property

In some DDE problems, the times of specific events are important. While solving a problem, the solvers can detect such events by locating transitions to, from, or through zeros of user-defined functions.

The following table describes the Events property.

DDE Events Property





Function handle

A function handle that includes one or more event functions. For dde23 and ddesd, this function has the following syntax:

[value,isterminal,direction] = events(t,y,YDEL)

For ddensd, the syntax is:

[value,isterminal,direction] = events(t,y,YDEL,YPDEL)

The output arguments, value, isterminal, and direction, are vectors for which the ith element corresponds to the ith event function:

  • value(i) is the value of the ith event function.

  • isterminal(i) = 1 if you want the integration to terminate at a zero of this event function, and 0 otherwise.

  • direction(i) = 0 if you want the solver to locate all zeros (the default), +1 if only zeros where the event function is increasing, and -1 if only zeros where the event function is decreasing.

    If you specify an events function and events are detected, the solver returns three additional fields in the solution structure sol:

  • sol.xe is a row vector of times at which events occur.

  • is a matrix whose columns are the solution values corresponding to times in sol.xe.

  • is a vector containing indices that specify which event occurred at the corresponding time in sol.xe.

For examples that use an event function while solving ordinary differential equation problems, see ODE Event Location.

Discontinuity Properties

The solver functions can solve problems with discontinuities in the history or in the coefficients of the equations. The following properties enable you to provide these solvers with a different initial value, and, for dde23, locations of known discontinuities. For more information, see Discontinuities in DDEs.

The following table describes the discontinuity properties.

DDE Discontinuity Properties






Location of discontinuities. Points t where the history or solution may have a jump discontinuity in a low-order derivative. This applies only to the dde23 solver.



Initial value of solution. By default the initial value of the solution is the value returned by history at the initial point. Supply a different initial value as the value of the InitialY property.


To create an options structure that changes the relative error tolerance of the solver from the default value of 1e-3 to 1e-4, enter

options = ddeset('RelTol',1e-4);

To recover the value of 'RelTol' from options, enter


ans =


See Also

| | |

Introduced before R2006a

Was this topic helpful?