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 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{DISPLAYTITLE:{{SUBPAGENAME}}}} | ||
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 [[ | 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|qinterp]]() to compute the interpolated peak coordinates. | ||
;Usage: <code>ipeak(<var>y</var> {, <var>npeaks</var>, <var>i1</var>, <var>i2</var>, <var>nwidth</var>, <var>ymin</var>})</code> | ;Usage: <code>ipeak(<var>y</var> {, <var>npeaks</var>, <var>i1</var>, <var>i2</var>, <var>nwidth</var>, <var>ymin</var>})</code> | ||
:;<var>y</var>: data vector (the function). | :;<var>y</var>: data vector (the function). | ||
Line 14: | Line 13: | ||
::# (''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]] | |||
[[../#Functions|<function list>]] | |||
Revision as of 11:05, 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 localn 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