Create or modify an ODE options structure.
When called with no input argument and one output argument, return a new ODE options structure that contains all possible fields initialized to their default values. If no output argument is requested, display a list of the common ODE solver options along with their default value.
If called with name-value input argument pairs "field1", "value1", "field2", "value2", … return a new ODE options structure with all the most common option fields initialized, and set the values of the fields "field1", "field2", … to the values value1, value2, ….
If called with an input structure oldstruct then overwrite the values of the options "field1", "field2", … with new values value1, value2, … and return the modified structure.
When called with two input ODE options structures oldstruct and newstruct overwrite all values from the structure oldstruct with new values from the structure newstruct. Empty values in newstruct will not overwrite values in oldstruct.
The most commonly used ODE options, which are always assigned a value
by odeset
, are the following:
Absolute error tolerance.
Use BDF formulas in implicit multistep methods. Note: This option is not yet implemented.
Event function. An event function must have the form
[value, isterminal, direction] = my_events_f (t, y)
Consistent initial slope vector for DAE solvers.
Initial time step size.
Jacobian matrix, specified as a constant matrix or a function of time and state.
Specify whether the Jacobian is a constant matrix or depends on the state.
If the Jacobian matrix is sparse and non-constant but maintains a constant sparsity pattern, specify the sparsity pattern.
Mass matrix, specified as a constant matrix or a function of time and state.
Specify whether the mass matrix is singular. Accepted values include
"yes"
, "no"
, "maybe"
.
Maximum order of formula.
Maximum time step value.
Specify whether the mass matrix depends on the state or only on time.
If the mass matrix is sparse and non-constant but maintains a constant sparsity pattern, specify the sparsity pattern. Note: This option is not yet implemented.
Specify elements of the state vector that are expected to remain nonnegative during the simulation.
Control error relative to the 2-norm of the solution, rather than its absolute value.
Function to monitor the state during the simulation. For the form of
the function to use see odeplot
.
Indices of elements of the state vector to be passed to the output monitoring function.
Specify whether output should be returned only at the end of each time step or also at intermediate time instances. The value should be a scalar indicating the number of equally spaced time points to use within each timestep at which to return output. Note: This option is not yet implemented.
Relative error tolerance.
Print solver statistics after simulation.
Specify whether odefun
can be passed multiple values of the
state at once.
Field names that are not in the above list are also accepted and added to the result structure.
See also: odeget.
The following code
## A new ODE options structure with default values is created. odeoptA = odeset ();
gives an example of how 'odeset' is used.
The following code
## A new ODE options structure with manually set options ## for "AbsTol" and "RelTol" is created. odeoptB = odeset ("AbsTol", 1e-2, "RelTol", 1e-1);
gives an example of how 'odeset' is used.
The following code
## A new ODE options structure is created from odeoptB with ## a modified value for option "NormControl". odeoptB = odeset ("AbsTol", 1e-2, "RelTol", 1e-1); odeoptC = odeset (odeoptB, "NormControl", "on");
gives an example of how 'odeset' is used.
Package: octave