Main Content

Algorithm

Algorithm for zero-crossing detection with variable-step solver

Model Configuration Pane: Solver

Description

The Algorithm parameter specifies whether to use the adaptive or nonadaptive algorithm for zero-crossing detection. Both zero-crossing detection algorithms detect the occurrence of a zero crossing and then locate the time at which the zero crossing occurred through a process called bracketing. The nonadaptive algorithm always continues bracketing until determining the time at which the state value crosses zero. The adaptive algorithm 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.

Programmatic Use

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

Version History

Introduced in R2008a