Programmer Guide/Command Reference/EVAL/ipeak: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 10: | Line 10: | ||
:The ''y'' value at index ''i'' is a local peak if: | :The ''y'' value at index ''i'' is a local peak if: | ||
:# the index is in the range ''i1'' <= ''i'' <= ''i2'' | :# the index is in the range ''i1'' <= ''i'' <= ''i2'' | ||
:# ''y''[i] is greater than the threshold ''ymin''/''ymin''[i] | :# ''y''[''i''] is greater than the threshold ''ymin''/''ymin''[''i''] | ||
:# (''y''[i-1]+''y''[i+1])/2 < ''y''[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 | :# ''y''[''i''-''k''-1] <= ''y''[''i''-''k''] and ''y''[''i''+''k''+1] <= ''y''[''i''+''k'']; with: ''k''=0..''nwidth''-1 | ||
;See also: [[../qinterp|qinterp]], [[../formants|formants]] | ;See also: [[../qinterp|qinterp]], [[../formants|formants]] | ||
[[../#Functions|<function list>]] | [[../#Functions|<function list>]] |
Revision as of 11:06, 21 April 2011
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