amax {spectral}R Documentation

Local Maxima

Description

Determines all local maxima from a real valued vector.

Usage

amax(x)

Arguments

x

numeric vector

Details

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.

Value

returns the indicies of local maxima. If x[1] = max, then it is ignored.

Examples


a <- c(1,2,3,2,1,5,5,4)
amax(a) # 3, 6

[Package spectral version 2.0 Index]