Main Content

Detect zero crossings

The `dsp.ZeroCrossingDetector`

System object™ counts the number of times the signal crosses zero, or changes sign. To detect
if a signal in a given channel crosses zero, the object looks for the following conditions,
where, *x _{i-l}* is the current signal value and

*x*< 0 and_{i}*x*> 0_{i-1}*x*> 0 and_{i}*x*< 0_{i-1}For some positive integer

*L*,*x*< 0,_{i}*x*= 0, and_{i-l}*x*> 0, where $$0\le l\le L$$._{i-L-1}For some positive integer

*L*,*x*> 0,_{i}*x*= 0, and_{i-l}*x*< 0, where $$0\le l\le L$$._{i-L-1}

For the first input value, *x _{i-1 }* and

To count the number of times a signal crosses zero or changes sign:

Create the dsp.ZeroCrossingDetector object.

Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

returns a
zero crossing detection object that calculates the number of times the signal crosses
zero.`zcd`

= dsp.ZeroCrossingDetector

To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named `obj`

, use
this syntax:

release(obj)