Mathematics

Changing ODE Integration Properties

The default integration properties in the ODE solvers are selected to handle common problems. In some cases, you can improve ODE solver performance by overriding these defaults. You do this by supplying the solvers with an `options` structure that specifies one or more property values.

For example, to change the value of the relative error tolerance of the solver from the default value of `1e-3` to `1e-4`,

1. Create an options structure using the function `odeset` by entering
• ```options = odeset('RelTol', 1e-4);
```
2. Pass the `options` structure to the solver as follows:
• For all solvers except `ode15i`, use the syntax
• ```[t,y] = `solver`(odefun,tspan,y0,options)
```
• For `ode15i`, use the syntax
• ```[t,y] = ode15i(odefun,tspan,y0,yp0,options)
```

For an example that uses the `options` structure, see Example: Stiff Problem (van der Pol Equation). For a complete description of the available options, see the reference page for `odeset`.

 Example: Solving a Fully Implicit ODE Problem Examples: Applying the ODE Initial Value Problem Solvers