localMaximum | R Documentation |
The simplest local maximum detection using a sliding window searches for maxima in a window of a given size, and slides that window across the signal, shifting it one position at a time.
localMaximum(x, winSize = 5)
x |
a vector represents a signal profile |
winSize |
the slide window size, 5 by default. |
The default implementation found here shifts the window by half of its size instead of by one position at a time. This makes the implementation faster, at the expense of not being able to detect peaks that are too close to each other, if they appear in some positions with respect to the windows.
Additionally, this implementation removes all instances of peaks found at a distance less than the window size
Experimentally, we are exploring other algorithms for local maxima detection.
These algorithms can be chosen setting the "MassSpecWavelet.localMaximum.algorithm"
option. See the "Finding local maxima"
vignette for further details.
Return a vector with the same length of the input x. The position of
local maximum is set as 1L
, 0L
else where.
Pan Du and Sergio Oller
getLocalMaximumCWT()
x <- rnorm(200)
lmax <- localMaximum(x, 5)
maxInd <- which(lmax > 0)
plot(x, type = "l")
points(maxInd, x[maxInd], col = "red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.