Contains `findpeaks` function for Julia (v1.0)
Author tungli
11 Stars
Updated Last
2 Years Ago
Started In
March 2018


Contains findpeaks function is inspired by MATLAB's findpeaks function.

The package allows you to get positions of local maxima of one-dimensional data. Since real-world data are often noisy, there is usually a large number of local maxima that are of no interest. findpeaks offers filtering based on 4 parameters (can be combined):

  • peak height
  • distance between peaks
  • peak prominence
  • threshold - minimal difference between neighboring data points

Similar packages

If this repository does not match your needs, have a look at:


using Findpeaks

using DelimitedFiles

using Plots

data = readdlm("assets/example_spectrum.txt")
x = data[:, 1]
y = data[:, 2]

peaks = findpeaks(y, x, min_prom=1000.)

plot(x, y, title="Prominent peaks")
scatter!(x[peaks], y[peaks])

sep = 0.2

peaks = findpeaks(y, x, min_dist=sep)

plot(x, y, title="Peaks at least $sep units apart")
scatter!(x[peaks], y[peaks])


Pull requests are welcome!