islocalmin
Marks the local minima of a vector.
Category: Data Import and Analysis > Preprocessing Data
Syntax
TF = islocalmin(A)
true where an element is smaller than its neighbors.
[TF, P] = islocalmin(A)
Also returns the prominence of each valley.
TF = islocalmin(A, 'MinProminence', m)
Keeps only valleys whose prominence is at least m.
Description
A local minimum is a point strictly smaller than the neighbors on both sides. It is the mirror image of islocalmax: the prominence of a valley measures how deep it is below the highest ridge that separates it from a deeper valley.
Input arguments
A- Numeric vector or matrix (columns are analyzed).
'MinProminence'- Minimum depth a valley must have below its surroundings.
Output arguments
TF- Logical array the size of
A. P- Prominence values, zero at points that are not valleys.
Example
Valleys of a series
x = [3 1 3 0 3];
tf = islocalmin(x)
find(tf)
Output
tf = 1×5 logical array
0 1 0 1 0
ans = 1×2
2 4