Main Content

Type

Choice of variable- or fixed-step solver

Model Configuration Pane: Solver

Description

The Type parameter specifies whether to use a variable-step or a fixed-step solver to simulate the model. Both variable-step and fixed-step solvers have additional solver settings, including a choice of the solver to use.

When you configure a referenced model to use a local solver, the Type parameter for the referenced model specifies the local solver type, which must be Fixed-step. For more information, see Use Local Solvers in Referenced Models.

Settings

Variable-step (default) | Fixed-step
Variable-step

Step size varies from step to step, depending on model dynamics. A variable-step solver:

  • Reduces step size when model states change rapidly, to maintain accuracy

  • Increases step size when model states change slowly, to avoid unnecessary steps

A variable-step solver is recommended for models in which states change rapidly and models that contain discontinuities. In these cases, a variable-step solver requires fewer time steps than a fixed-step solver to achieve a comparable level of accuracy, which can significantly shorten simulation time.

Fixed-step

Step size remains constant throughout the simulation. The solver computes the next simulation time hit as the sum of the current simulation time and the step size.

Code generation requires a fixed-step solver. Typically, lower-order solvers are computationally more efficient than higher-order solvers. However, lower-order solvers are also less accurate than higher-order solvers.

When you configure a referenced model to use a local solver, the top solver can be a variable-step or fixed-step solver, and the local solver must be a fixed-step solver. For more information, see Use Local Solvers in Referenced Models.

Recommended Settings

The table summarizes recommended values for this parameter based on considerations related to code generation.

Code generation requires a fixed-step solver.

ApplicationSetting
DebuggingFixed-step
TraceabilityFixed-step
EfficiencyFixed-step
Safety precautionFixed-step

Programmatic Use

Parameter: SolverType
Type: string | character vector
Values: "Variable-step" | "Fixed-step"
Default: "Variable-step"

Version History

Introduced before R2006a