| Mathematics | ![]() |
Changing DDE Integration Properties
The default integration properties in the DDE solver dde23 are selected to handle common problems. In some cases, you can improve solver performance by changing these defaults. To do this, create an options structure containing one or more property values and supply it to dde23.
In this and subsequent property tables, the most commonly used property categories are listed first, followed by more advanced categories.
| Properties Category |
Property Name |
| Error control |
RelTol, AbsTol, NormControl |
| Solver output |
OutputFcn, OutputSel, Stats |
| Step-size |
InitialStep, MaxStep |
| Event location |
Events |
| Discontinuities |
InitialY, Jumps |
Creating and Maintaining a DDE Options Structure
The ddeset function creates an options structure that you can supply to dde23. You can use ddeget to query the options structure for the value of a specific property.
Creating an Options Structure. The ddeset function accepts property name/property value pairs using the syntax
This creates a structure options in which the named properties have the specified values. Unspecified properties retain their default values. For all properties, it is sufficient to type only the leading characters that uniquely identify the property name. ddeset ignores case for property names.
With no arguments, ddeset displays all property names and their possible values, indicating defaults with braces {}.
Modifying an Existing Options Structure. To modify an existing options argument, use
This overwrites any values in oldopts that are specified using name/value pairs. dde23 returns the modified structure as the output argument. In the same way, the command
combines the structures oldopts and newopts. In options, any values set in newopts overwrite those in oldopts.
Querying an Options Structure. The ddeget function extracts a property value from an options structure created with ddeset.
This returns the value of the specified property, or an empty matrix [] if you specify no property value in the options structure.
As with ddeset, it is sufficient to type only the leading characters that uniquely identify the property name. ddeget ignores case for property names.
Error Control Properties
At each step, the dde23 solver estimates the local error e in the ith component of the solution. 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 dde23 solver delivers accuracy roughly equivalent to the accuracy you request. It delivers 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. Use ddeset to set the properties.
The solver output properties let you control the output that the solvers generate. Use ddeset to set these properties.
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. Use ddeset to set these properties.
| Property |
Value |
Description |
InitialStep |
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), and 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. |
MaxStep |
Positive scalar {0.1*abs(t0-tf)} |
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:
|
|
Event Location Property
In some DDE problems, the times of specific events are important. While solving a problem, the dde23 solver can detect such events by locating transitions to, from, or through zeros of user-defined functions.
The following table describes the Events property. Use ddeset to set this property.
| String |
Value |
Description |
Events |
Function |
Function that includes one or more event functions. The function is of the formvalue, isterminal, and direction are vectors for which the ith element corresponds to the ith event function:
sol:
For examples that use an event function while solving ordinary differential equation problems, see Example: Simple Event Location ( |
Discontinuity Properties
dde23 can solve problems with discontinuities in the history or discontinuities in coefficients of the equations. These properties enable you to provide dde23 with a different initial value, and locations of known discontinuities. See Discontinuities for more information.
| Discontinuities | Boundary Value Problems for ODEs | ![]() |