User`s guide

Edge Detector
5-166
5Edge Detector
Purpose Detect a transition of the input from zero to a nonzero value.
Library Signal Management / Switches and Counters
Description 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. Otherwise, the block generates zeros in each channel.
The output has the same dimension and sample rate as the input. If the input
is frame-based, the output is frame-based; otherwise, the output is
sample-based. For frame-based input, an edge that is split across two
consecutive frames (i.e., a zero at the bottom of the first frame, and a nonzero
value at the top of the following frame) is counted in the frame that contains
the nonzero value.
Example In the model below, the Edge Detector block locates the edges (zero to nonzero
transitions) in a two-channel frame-based input with frame size 3. The two
input channels are horizontally concatenated with the two output channels to
create the four-channel workspace variable
yout.
Adjust the block parameters as described below. (Use the default settings for
the To Workspace block.)
Set the Signal From Workspace block parameters as follows:
-
Signal = [(-5:5);01002000300]'
- Sample time = 1
- Samples per frame = 3
Set the Matrix Concatenation block parameters as follows:
-
Number of inputs = 2
- Concatenation method = Horizontal
As shown below, the block finds edges at sample 7 in channel 1, and at samples
2, 5, and 9 in channel 2.