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

From STX Wiki
Jump to navigationJump to search
(initial import)
 
No edit summary
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====ipeak=====
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>
:;<var>y</var>: data vector (the function).
:;<var>npeaks</var>: the maximum number of peaks to locate (default=1)
:;<var>i1, i2</var>: the index range to be searched (default=1,<code>ncol(''y'')-1</code>)
:;<var>nwidth</var>: the minimum width of a peak (+/-) (default=1)
:;<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.
:The ''y'' value at index ''i'' is a local peak if:
:# the index is in the range ''i1'' &le; ''i'' &le; ''i2''
:# ''y''[''i''] is greater than the threshold ''ymin''/''ymin''[''i'']
:# (''y''[''i''-1]+''y''[''i''+1])/2 < ''y''[''i'']
:# ''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]]


Search the function y for local peaks and return either a scalar or a vector with indexes of the peak values. The result can, for example, be passed directly to [[Programmer Guide/Command Reference/EVAL/qinterp|qinterp]]() for interpolation. This is a subcommand of the <code>[[Programmer Guide/Command Reference/EVAL/EVAL|EVAL]]</code> command.
[[../#Functions|<function list>]]
 
=====Usage:=====
 
<code>ipeak(<var>y</var>, <var>npeaks</var>, <var>istart</var>, <var>iend</var>, <var>nwidth</var>, <var>ymin</var>)</code>
 
=====Parameters:=====
 
;<var>y</var>
 
:The data vector (the function).
 
;<var>npeaks</var>
 
:The maximum number of peaks. The default is <code>1</code>.
 
;<var>istart</var>
 
:The index to start with. The default is <code><code>0</code></code>.
 
;<var>iend</var>
 
:The index to end with. The default is <code>y[1nrow]-1</code>.
 
;<var>nwidth</var>
 
:The width of the peak (+/-). The default is <code><code>1</code>.</code>
 
;<var>ymin</var>
 
:The threshold (a scalar or a vector). By default there is no threshold.
 
=====Return Type:=====
 
scalar or vector

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