peaks
Determines all of the local extreme values of a vector.
Syntax
peaks(vector, [option])
Argument
- vector
- The vector to be scanned for extrema.
- [option]
- Indicates the type of extrema for which to search.
- option < 0
- Only minima.
- option = 0
- Minima and maxima.
- option > 0
- Only maxima.
Example
Templex Expression | Results |
---|---|
{a={1,2,3,2,2,5,6,-1,5}}
|
{2,6} |
{a={1,2,3,2,2,5,6,-1,5}}
|
{2,3,4,6,7} |
Comments
This function returns the indices of the local extreme values of a vector. The returned indices are zero-based. A value is considered to be a local maximum if it is greater than or equal to each of its neighboring values. A value is considered to be a local minimum if it is less than or equal to each of its neighboring values.