localMaximum: Identify local maximum within a slide window.

Description Usage Arguments Details Value Author(s) See Also Examples

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

1
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

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

Example output

Loading required package: waveslim

waveslim: Wavelet Method for 1/2/3D Signals (version = 1.7.5)

MassSpecWavelet documentation built on Nov. 8, 2020, 5:36 p.m.