DSP Blockset    
Edge Detector

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.)

As shown below, the block finds edges at sample 7 in channel 1, and at samples 2, 5, and 9 in channel 2.

Dialog Box

Supported Data Types

To learn how to convert to the above data types in MATLAB and Simulink, see Supported Data Types and How to Convert to Them.

See Also

Counter
DSP Blockset
Event-Count Comparator
DSP Blockset

Also see Switches and Counters for a list of all the blocks in the Switches and Counters library.


  Dyadic Synthesis Filter Bank Event-Count Comparator