MATLAB Function Reference    
odeset

Create or alter options structure for input to ordinary differential equation (ODE) solvers

Syntax

Description

The odeset function lets you adjust the integration parameters of the ODE solvers. The ODE solvers can integrate systems of differential equations of one of these forms

or

See below for information about the integration parameters.

options = odeset('name1',value1,'name2',value2,...) creates an integrator options structure 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 a property name. Case is ignored for property names.

options = odeset(oldopts,'name1',value1,...) alters an existing options structure oldopts.

options = odeset(oldopts,newopts) alters an existing options structure oldopts by combining it with a new options structure newopts. Any new options not equal to the empty matrix overwrite corresponding options in oldopts.

odeset with no input arguments displays all property names as well as their possible and default values.

ODE Properties

The available properties depend on the ODE solver used. There are several categories of properties:

Error Tolerance Properties
Property
Value
Description
RelTol
Positive scalar {1e-3}
A relative error tolerance that applies to all components of the solution vector. The estimated error in each integration step satisfies
|e(i)|<=max(RelTol*abs(y(i)),AbsTol(i)
AbsTol
Positive scalar or vector {1e-6}
The absolute error tolerance. If scalar, the tolerance applies to all components of the solution vector. Otherwise the tolerances apply to corresponding components.
NormControl
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
Property
Value

Description
OutputFcn
Function
Installable output function. The ODE solvers provide sample functions that you can use or modify:


odeplot
Time series plotting (default)


odephas2
Two-dimensional phase plane plotting


odephas3
Three-dimensional phase plane plotting


odeprint
Print solution as it is computed


To create or modify an output function, see ODE Solver Output Properties in the "Differential Equations" section of the MATLAB documentation.
OutputSel
Vector of integers
Output selection indices. Specifies the components of the solution vector that the solver passes to the output function. OutputSel defaults to all components.
Refine
Positive integer
Produces smoother output, increasing the number of output points by the specified factor. The default value is 1 in all solvers except ode45, where it is 4. Refine doesn't apply if length(tspan) > 2.
Stats
on | {off}
Specifies whether the solver should display statistics about the computational cost of the integration.

Jacobian Matrix Properties (for ode15s, ode23s, ode23t, and ode23tb)
Property
Value
Description
Jacobian
Function | constant matrix
Jacobian function. Set this property to @FJac (if a function FJac(t,y) returns ) or to the constant value of .
JPattern
Sparse matrix of {0,1}
Sparsity pattern. Set this property to a sparse matrix with if component of depends on component of , and 0 otherwise.
Vectorized
on | {off}
Vectorized ODE function. Set this property on to inform the stiff solver that the ODE function F is coded so that F(t,[y1 y2 ...]) returns the vector [F(t,y1) F(t,y2) ...]. That is, your ODE function can pass to the solver a whole array of column vectors at once. A stiff function calls your ODE function in a vectorized manner only if it is generating Jacobians numerically (the default behavior) and you have used odeset to set Vectorized to on.

Event Location Property
Property
Value
Description
Events
Function
Locate events. Set this property to @Events, where Events is the name of the events function. See the ODE solvers for details.



Mass Matrix and DAE-Related Properties
Property
Value
Description
Mass
Constant matrix | function
For problems set this property to the value of the constant mass matrix . For problems , set this property to @Mfun, where Mfun is a function that evaluates the mass matrix .
MStateDependence
none | {weak} | strong
Dependence of the mass matrix on . Set this property to none for problems . Both weak and strong indicate , but weak results in implicit solvers using approximations when solving algebraic equations. For use with all solvers except ode23s.
MvPattern
Sparse matrix
sparsity pattern. Set this property to a sparse matrix with if for any , the component of depends on component of , and 0 otherwise. For use with the ode15s, ode23t, and ode23tb solvers when MStateDependence is strong.
MassSingular
yes | no | {maybe}
Indicates whether the mass matrix is singular. The default value of 'maybe' causes the solver to test whether the problem is a DAE. For use with the ode15s and ode23t solvers.
InitialSlope
Vector
Consistent initial slope , where satisfies

. For use with the ode15s and ode23t solvers when solving DAEs.



Step Size Properties
Property
Value
Description
MaxStep
Positive scalar
An upper bound on the magnitude of the step size that the solver uses. The default is one-tenth of the tspan interval.
InitialStep
Positive scalar
Suggested initial step size. The solver tries this first, but if too large an error results, the solver uses a smaller step size. By default the solver determines an initial step size automatically.

In addition there are two options that apply only to the ode15s solver.

ode15s Properties
Property
Value
Description
MaxOrder
1 | 2 | 3 | 4 | {5}
The maximum order formula used.
BDF
on | {off}
Set on to specify that ode15s should use the backward differentiation formulas (BDFs) instead of the default numerical differentiation formulas (NDFs).

See Also

deval, odeget, ode45, ode23, ode23t, ode23tb, ode113, ode15s, ode23s, @ (function handle)


  odeget ones