GETPEAK

Purpose:

Finds the peaks of a series or table.

Syntax:

GETPEAK(series, threshold, width, size, padmode, fillval)

series

-

An input series.

threshold

-

Optional. A real, the minimum value above which peaks will be accepted. Defaults to the minimum of the series.

width

-

Optional. An integer that specifies the minimum number of points that comprise a peak. Defaults to 1.

size

-

Optional. Specifies the minimum acceptable peak to valley height of a peak. Defaults to 0.0.

padmode

-

Optional. An integer, determines whether the values between the peaks in the resulting series will be padded.

0:

do not pad

1:

pad (default)

2:

linear interpolation

fillval

-

The padding value to use when padmode is on. Defaults to 0.0.

Returns:

A series or table.

Example:

getpeak(W1)

 

finds all the peaks of Window 1.

Example:

W2: gsin(128, 1/128, 4)

getpeak(W2)

 

finds the four peaks associated with the peak of each sine wave.

Example:

getpeak(W1, min(W1), 1, 0.0, 1, 0.0)

 

Same as above. Note that because the default fillval is 0.0, it is possible that peaks and valleys of height 0.0 will be indistinguishable from the fillval. If this is a problem, set the fillval to be the minimum of the input series for GETPEAK and the maximum value of the input series for GETVALLEY.

Remarks:

If padmode is set to 0 (do not pad), GETPEAK returns an XY series where the X values are set to the location of the peaks, and the Y values are set to the amplitude of the peaks. If padmode is set to 1, non-peak values are set to 0.0. If padmode is set to 2, GETPEAK performs envelope detection by linearly interpolating between detected peaks.

 

The default values for the optional arguments suffice for most applications.

See Also:

GETVALLEY

LEVELCROSS

XY