amax {spectral} | R Documentation |
Determines all local maxima from a real valued vector.
amax(x)
x |
numeric vector |
The purpose is to detect all local maxima in a real valued 1D vector.
If the first element x[1]
is the global maximum, it is ignored,
because there is no information about the previous element. If there
is a plateau, the first edge is detected.
returns the indicies of local maxima. If x[1] = max
, then
it is ignored.
a <- c(1,2,3,2,1,5,5,4)
amax(a) # 3, 6