Main Content

Algorithm

Algorithm for zero-crossing detection with variable-step solver

Model Configuration Pane: Solver

Description

The algorithm for zero-crossing detection detects the occurrence of a zero crossing and then locates the time at which the zero crossing occurred through a process called bracketing. Use this parameter to specify whether the software uses a nonadaptive algorithm that always locates when the state value crosses zero or an adaptive algorithm that allows for tolerance in the bracketing process.

Dependencies

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

Settings

Nonadaptive (default) | Adaptive
Nonadaptive

This option uses the zero-crossing algorithm present in the Simulink® software prior to Version 7.0 (R2008a). The nonadaptive algorithm detects and locates zero crossings accurately but might decrease simulation speed for systems with strong chattering, or high-frequency oscillation around the zero-crossing point, also known as Zeno behavior.

Adaptive

This option uses an improved zero-crossing algorithm that dynamically determines whether to use bracketing locate the precise time at which the zero crossing occurred. The adaptive algorithm can improve simulation speed for systems with strong chattering.

Selecting the Adaptive algorithm enables the Signal threshold parameter. The value of the Signal threshold parameter determines when the state value is close enough to zero for the adaptive algorithm to stop bracketing.

Recommended Settings

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

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Programmatic Use

Parameter: ZeroCrossAlgorithm
Type: string | character vector
Value: 'Nonadaptive' | 'Adaptive'
Default: 'Nonadaptive'

Version History

Introduced in R2008a