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

From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import)
No edit summary
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 [[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 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.
;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).
=====Usage:=====
:;<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>)
<code>ipeak(<var>y</var>, <var>npeaks</var>, <var>istart</var>, <var>iend</var>, <var>nwidth</var>, <var>ymin</var>)</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)
=====Parameters:=====
;Result: A scalar or a vector containing the indices of the located peaks.
 
:A value ''y''[i] is a peak if:
;<var>y</var>
::* the index is in the range ''i1'' <= ''i'' <= ''i2''
 
::* ''y''[i] is greater than the threshold ''ymin''/''ymin''[i]
:The data vector (the function).
::* (''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
;<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

Revision as of 10:06, 11 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.
A value y[i] is a 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..npeaks

Navigation menu

Personal tools