ipeak

From STX Wiki
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.
A '#y value at index i is a peak if:
  1. the index is in the range i1 <= i <= i2
  2. y[i] is greater than the threshold ymin/ymin[i]
  3. (y[i-1]+y[i+1])/2 < y[i]
  4. y[i-k-1] <= y[i-k] and y[i+k+1] <= y[i+k]; with: k=0..nwidth-1

Navigation menu

Personal tools