Main Content

matlab.ode.options.CVODESNonstiff Properties

Options for CVODESNonstiff solver

Since R2024a

matlab.ode.options.CVODESNonstiff objects are used with ode objects to specify options for the solution of ordinary differential equations. ode objects automatically populate the SolverOptions property with an options object specific to the selected solver, so you generally do not need to create matlab.ode.options.CVODESNonstiff objects explicitly.

Specify options for the ODE problem by changing property values of the matlab.ode.options.CVODESNonstiff object using dot notation. For example, if F is an ode object, then F.SolverOptions.InitialStep = 1e-3 specifies an initial step size for the solver to take.

Step-Size

expand all

Suggested initial step size, specified as a positive scalar. InitialStep sets an upper bound on the size of the first step that the solver tries.

If you do not specify an initial step size, then the solver bases the initial step size on the slope of the solution at the initial time point of the integration. If the slope of all solution components is zero, then the solver might try a step size that is too large. If you know that the initial step size is too large, or if you want to be sure that the solver resolves important behavior at the beginning of the integration, then use InitialStep to provide a suitable initial step size.

Example: F.SolverOptions.InitialStep = 1e-3, where F is an ode object, sets an upper bound of 1e-3 on the size of the initial step.

Maximum step size, specified as a positive scalar. MaxStep sets an upper bound on the size of any step that the solver takes. If the equation has periodic behavior, for example, then you can set MaxStep to a fraction of the period so that the solver does not step over an area of interest.

  • Do not use MaxStep just to obtain more output points, as it can significantly slow down the integration. Instead, use the Refine option of the solve method to compute additional points at low computational cost.

  • Do not use MaxStep to increase the accuracy of the solution. If the solution is not accurate enough, then reduce the value of RelativeTolerance and use the solution to determine a suitable value for AbsoluteTolerance.

  • Avoid using MaxStep to make sure the solver does not step over some behavior that occurs only once in the integration interval. If you know the time at which the behavior occurs, then break the interval into two pieces and solve each separately. If you do not know the time at which the change occurs, try reducing RelativeTolerance and AbsoluteTolerance. Use MaxStep only as a last resort in this case.

Example: F.SolverOptions.MaxStep = 1e-2, where F is an ode object, sets a limit of 1e-2 on the step size.

Other Properties

expand all

Maximum order of formula, specified as a positive integer. Use this property to specify the maximum order of the formulas used by the "cvodesNonstiff" solver.

Example: F.SolverOptions.MaxOrder = 4, where F is an ode object, specifies a maximum order of 4 for the solver formulas.

Version History

Introduced in R2024a