zero_cross
count zero crossings
Synopsis
#include <stats.h>
int zero_crossf(a,n)
const float a[];
int n;
zero_cross_fr16 (a, n)
const fract16 a[];
int n;
Description
This function computes the number of times that a signal crosses over the
zero line and returns the result. If all the input values are zero, the func-
tion returns a zero.
Algorithm
The actual algorithm is different from the one shown below because the
algorithm needs to handle the case where an element of the array is zero.
However, this example should give you a basic understanding.
if ( a(i) > 0 && a(i+1) < 0 )|| (a(i) < 0) && a(i+1) > 0 )
the number of zeros is increased by on
Domain
38
-3.4 x 10
to +3.4 x 10
-1.0 to +1.0
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
for ADSP-219x DSPs
/* Pointer to input vector a
/* Number of input samples
/* Pointer to input vector a
/* Number of input samples
38
for
zero_crossf( )
for
zero_cross_fr16( )
DSP Run-Time Library
e
*/
*/
*/
*/
4-109
Need help?
Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?