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. For more information, see Use Local Solvers in Referenced Models.
Before R2025a: When you configure a model to use a local solver when referenced by another model, the local solver must be a fixed-step solver.
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.
Programmatic Use
Parameter: SolverType |
Type: string | character vector |
Values:
"Variable-step" | "Fixed-step" |
Default:
"Variable-step" |
Version History
Introduced before R2006a