Detect transition from zero to nonzero value
Signal Management / Switches and Counters
The Edge Detector block generates an impulse (the value 1) in a given output channel when the corresponding channel of the input transitions from zero to a nonzero value. When the input does not transition from zero to a nonzero value, the block generates a zero in the corresponding output channel.
This block supports only discrete-time fixed-step signals. Continuous signals are not supported.
The output has the same dimension and sample rate as the input. When you set the
Input processing parameter to
Columns as channels
(frame based), the block counts an edge that is split across two
consecutive frames in the frame that contains the nonzero value. For example, if there
is a zero at the bottom of the first frame and a nonzero value at the top of the second
frame, the block counts the edge in the second frame.
In the ex_edgedetector_ref model,
the Input processing parameter of the Edge Detector block is set to
Columns as channels (frame based). Thus, the block
interprets the 3-by-2 input as a multichannel signal with a frame size of 3. The Matrix
Concatenate block concatenates the two input channels of the original signal with the
two output channels of the Edge Detector block to create the four-channel workspace
As shown in the following figure, the block finds edges at sample 7 in channel 1, and at samples 2, 5, and 9 in channel 2.
Specify how the block should process the input. You can set this parameter to one of the following options:
Columns as channels (frame based) (default)
— 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.
Double-precision floating point
Single-precision floating point
Fixed point (signed and unsigned)
Boolean — The block might output Boolean values depending on the input data type, and whether Boolean support is enabled or disabled.
8-, 16-, and 32-bit signed integers
8-, 16-, and 32-bit unsigned integers
Generated code relies on
memset functions (
string.h) under certain