Determines all the local extreme values of a vector. |
||
Syntax |
e, i = Peaks(m, option) |
|
Argument |
Name |
Description |
m |
A vector which is scanned for extrema. |
|
option (optional) |
Indicates the type of extrema to search. option = 'min': only minima. option = 'both': minima and maxima. option = 'max': only maxima. The default is ‘both’. |
|
Output |
Name |
Description |
e |
A vector of the extreme values. |
|
i |
The indices of the extrema in the vector. It has the same length as the extrema vector. |
|
Example |
Find the local minima in a given vector: |
|
Syntax |
||
E,I = Peaks([2, 5, -1, 4, 3, 3, 5, 7], ’min’) |
||
Result |
||
E = -1 3 3 I = 3 5 6 |
||
Comments |
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. End points are not considered extrema. |