Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


phonTools (version 0.2-2.0)

peakfind: Find the Peaks

Description

Locate the peaks in a numeric vector.

Usage

peakfind (x, show = TRUE)

Arguments

x
A vector whose peaks are to be located.
show
If TRUE, the vector is plotted and peaks are indicated with red triangles.

Value

  • A vector indicating the location (position in the vector) of peaks in the vector.

Details

This function looks for peaks by finding elements whose value is greater than both the elements that surround it. If no peaks are found, a value of zero is returned.

Examples

Run this code
data (sound)
sound2 = sound$sound[10000:11000] 
spectrum = spectralslice (sound2, padding = 0, output = TRUE, show = TRUE)
peakfind (spectrum[,2])

Run the code above in your browser using DataLab