Main Content

Number of consecutive zero crossings

Threshold for issuing diagnostic due to consecutive zero crossings

Model Configuration Pane: Solver


The software counts the number of consecutive zero crossings detected and issues a diagnostic when the count exceeds the amount specified by this parameter. You can specify whether the diagnostic is a warning or an error using the Consecutive zero-crossings violation parameter. The counter resets when the simulation progresses without detecting another zero crossing long enough for the next zero crossing to be considered nonconsecutive. To specify how close zero crossings must occur to be considered consecutive, use the Time tolerance parameter.


To enable this parameter, set the solver Type to Variable-step and set Zero-crossing control to either Use local settings or Enable all.


1000 (default) | positive scalar integer

If your model experiences excessive zero crossings, you can increase this parameter value to increase the threshold at which the software issues the Consecutive zero-crossings violation diagnostic. Allowing more consecutive zero crossings can give the model behavior more time to recover.

Recommended Settings

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

DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

Parameter: MaxConsecutiveZCs
Type: string | character vector
Value: positive scalar integer
Default: '1000'

Version History

Introduced before R2006a