ipeak
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
Search the function y for local peaks and return either a scalar or a vector with indices of the peak values. The result can, for example, be passed directly to qinterp() to compute the interpolated peak coordinates.
- Usage
ipeak(y {, npeaks, i1, i2, nwidth, ymin})
- y
- data vector (the function).
- npeaks
- the maximum number of peaks to locate (default=1)
- i1, i2
- the index range to be searched (default=1,
ncol(y)-1
) - nwidth
- the minimum width of a peak (+/-) (default=1)
- ymin
- the threshold; must be a scalar or a vector with the same length as y (default: no threshold)
- Result
- A scalar or a vector containing the indices of the located peaks.
- The y value at index i is a local peak if:
- the index is in the range i1 ≤ i ≤ i2
- y[i] is greater than the threshold ymin/ymin[i]
- (y[i-1]+y[i+1])/2 < y[i]
- y[i-k-1] ≤ y[i-k] and y[i+k+1] ≤ y[i+k]; with: k=0..nwidth-1