Threshold Detector VI

Owning Palette: Signal Operation VIs

Requires: Full Development System

Analyzes the input sequence X for valid peaks and keeps a count of the number of peaks encountered and a record of Indices, which locates the points that exceed the threshold in a valid peak.

Details  

 Add to the block diagram  Find on the palette
X is the input sequence. The number of samples in X must be greater than the specified width. If X is less than or equal to width, the VI sets count to zero and returns an error.
threshold is the level that all valid peaks must equal or exceed for the duration of width samples. The default is 0.0.
width determines the minimum width, in number of samples, that the input sequence X must remain at or above the threshold value for the candidate peak to be considered valid. width must be greater than zero. If width is less than or equal to zero, the VI sets count to zero and returns an error. The default is 1.
Indices contains the beginning index of all valid peaks.
count is the number of valid peaks.
error returns any error or warning from the VI. You can wire error to the Error Cluster From Error Code VI to convert the error code or warning into an error cluster.

Threshold Detector Details

A peak is valid where the consecutive elements of X exceed the threshold, and the number of elements that exceed the threshold is equal to at least width. The Threshold Detector VI detects the peak when the number of consecutive elements that exceed the threshold is greater than or equal to width.

The following figure shows the threshold detector result of a sinusoid waveform, where the threshold is 0.1 and the width is 4. The green cross represents the beginning index of a detected peak.

The following figure also shows a valid peak. Here the input waveform is a step signal. The threshold is 0.5 and the width is 5. Since thirteen consecutive elements exceed the threshold, the beginning index of the peak is 8.

Refer to the following support document at ni.com for more information about peak detection using LabVIEW.