Navigation

Operators and Keywords

Function List:

C++ API

: odestruct = odeset ()
: odestruct = odeset ("field1", value1, "field2", value2, …)
: odestruct = odeset (oldstruct, "field1", value1, "field2", value2, …)
: odestruct = odeset (oldstruct, newstruct)
: odeset ()

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:

AbsTol

Absolute error tolerance.

BDF

Use BDF formulas in implicit multistep methods. Note: This option is not yet implemented.

Events

Event function. An event function must have the form [value, isterminal, direction] = my_events_f (t, y)

InitialSlope

Consistent initial slope vector for DAE solvers.

InitialStep

Initial time step size.

Jacobian

Jacobian matrix, specified as a constant matrix or a function of time and state.

JConstant

Specify whether the Jacobian is a constant matrix or depends on the state.

JPattern

If the Jacobian matrix is sparse and non-constant but maintains a constant sparsity pattern, specify the sparsity pattern.

Mass

Mass matrix, specified as a constant matrix or a function of time and state.

MassSingular

Specify whether the mass matrix is singular. Accepted values include "yes", "no", "maybe".

MaxOrder

Maximum order of formula.

MaxStep

Maximum time step value.

MStateDependence

Specify whether the mass matrix depends on the state or only on time.

MvPattern

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.

NonNegative

Specify elements of the state vector that are expected to remain nonnegative during the simulation.

NormControl

Control error relative to the 2-norm of the solution, rather than its absolute value.

OutputFcn

Function to monitor the state during the simulation. For the form of the function to use see odeplot.

OutputSel

Indices of elements of the state vector to be passed to the output monitoring function.

Refine

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.

RelTol

Relative error tolerance.

Stats

Print solver statistics after simulation.

Vectorized

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.

Demonstration 1

The following code

 ## A new ODE options structure with default values is created.

 odeoptA = odeset ();

gives an example of how 'odeset' is used.

Demonstration 2

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.

Demonstration 3

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