Enable zero-crossing detection for fixed-step solver
Option to use zero-crossing detection with fixed-step solver
Model Configuration Pane: Solver
When you enable zero-crossing detection, you can sometimes use a larger step size without sacrificing accuracy. When a discontinuity occurs in the simulation, the zero-crossing algorithm calculates the time at which the discontinuity occurred and adjusts the continuous state values accordingly. By adjusting the state values only around discontinuities, the solver can retain the accuracy of a smaller step size with overall fewer calculations.
Consider enabling this parameter when your model contains continuous states.
The zero-crossing algorithm for fixed-step solvers has a bounded computational cost. You can adjust the maximum number of calculations that occur due to using zero-crossing detection by modifying the Maximum number of bracketing iterations and Maximum number of zero-crossings per step parameters.
Enabling this parameter enables these parameters:
To enable this parameter, set the solver Type to
Fixed-step and set Solver to any value except
discrete (no continuous states).
Fixed-step solver does not detect or locate zero crossings during simulation.
Fixed-step solver detects and locates zero crossings during simulation.
The table summarizes recommended values for this parameter based on considerations related to code generation.
|Safety precaution||No impact|
|Type: string | character vector|
Introduced in R2022a