Count number of times signal crosses zero in single time step
DSP System Toolbox / Signal Operations
The Zero Crossing block concludes that a signal in a given channel has passed through zero if it meets any of the following criteria, where xi is the current value of the signal, xi−1 is the previous value, and so on:
xi < 0 and xi−1 > 0
xi > 0 and xi−1 < 0
For a positive integer L, xi < 0, xi−1 = 0, and xi−L−1 > 0, where .
For a positive integer L, xi > 0, xi−1 = 0, and xi−L−1 < 0, where .
For the first value of the input signal, xi−1 and xi−2 are zero. The block outputs the number of times the signal crosses zero in a single time step at the Cnt port.
Port_1 — Data input
vector | matrix
The input signal specified as a real-valued vector or matrix.
Cnt — Number of zero crossings
scalar | row vector
The block outputs the number of zero crossings in the data input as one of these:
Scalar –– When the data input is a column vector, the block outputs a scalar value representing the number of zero crossings in the data input.
Row vector –– When the data input is a matrix, the block outputs a row vector with each element in the row vector representing the number of zero crossings in the corresponding column of the data input.
Input processing — Method to process input signals
Columns as channels (frame
based) (default) |
Elements as channels (sample based)
Specify how the block should process the input.
Columns as channels (frame based)— When you select this option, the block treats each column of the input as a separate channel.
Elements as channels (sample based)— When you select this option, the block treats each element of the input as a separate channel.
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Introduced before R2006a
Hit Crossing (Simulink)