Choice of variable- or fixed-step solver
Model Configuration Pane: Solver
Choose whether to use a variable-step or a fixed-step solver to simulate your model. For each option, you can configure additional solver settings, including a choice of the solver to use.
Variable-step (default) |
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.
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.
The table summarizes recommended values for this parameter based on considerations related to code generation.
|Type: string | character vector
Introduced before R2006a