Programmer Guide/Command Reference/EVAL/ipeak: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(9 intermediate revisions by 2 users not shown)
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 [[Programmer Guide/Command Reference/EVAL/qinterp|qinterp]]() to compute the interpolated peak coordinates.
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 9: Line 8:
:;<var>ymin</var>: the threshold; must be a scalar or a vector with the same length as ''y'' (default: no threshold)
:;<var>ymin</var>: 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.
;Result: A scalar or a vector containing the indices of the located peaks.
:A value ''y''[i] is a 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'' &le; ''i'' &le; ''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..npeaks
:# ''y''[''i''-''k''-1] &le; ''y''[''i''-''k''] and ''y''[''i''+''k''+1] &le; ''y''[''i''+''k'']; with: ''k''=0..''nwidth''-1
;See also: [[../qinterp|qinterp]], [[../formants|formants]]
 
[[../#Functions|<function list>]]

Latest revision as of 19:16, 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:
  1. the index is in the range i1ii2
  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
See also
qinterp, formants

<function list>

Navigation menu

Personal tools