localMaximum {MassSpecWavelet}R Documentation

Identify local maximum within a slide window.

Description

Find local maximum by transform the vector as matrix, then get the the maximum of each column. This operation is performed twice with vecctor shifted half of the winSize.

Usage

localMaximum(x, winSize = 5)

Arguments

x a vector represents a signal profile
winSize the slide window size, 5 by default.

Details

Instead of find the local maximum by a slide window, which slide all possible positions, we find local maximum by transform the vector as matrix, then get the the maximum of each column. This operation is performed twice with vecctor shifted half of the winSize. The main purpose of this is to increase the efficiency of the algorithm.

Value

Return a vector with the same length of the input x. The position of local maximum is set as 1, 0 else where.

Author(s)

Pan Du

See Also

getLocalMaximumCWT

Examples

x <- rnorm(200)
lmax <- localMaximum(x, 5)
maxInd <- which(lmax > 0)
plot(x, type='l')
points(maxInd, x[maxInd], col='red')

[Package MassSpecWavelet version 1.8.0 Index]