I have a data with noisy data which has lot of minimas. One such data file is shown here. What I have been trying to do is the following,

(1) I would to find all the minimas with respect to the common reference bar.

(2) then I have to find the distance between those minimas

(3) and make a histogram.

(2) ,(3) can be done if I could identify all the minimas. I tried couple of methods ,but did not get work here.

enter image description here

  • 6
    $\begingroup$ This, this, and FindPeaks and PeakDetect might be helpful. $\endgroup$ – corey979 Sep 12 '16 at 22:47
  • 1
    $\begingroup$ This question is basically a duplicate of "Finding Local Minima / Maxima in Noisy Data", so I vote to close. For example, see the results over the question data of my solution in the referenced discussion. $\endgroup$ – Anton Antonov Sep 12 '16 at 23:14
  • $\begingroup$ Mr Anton, Did you put a reference bar or something, You see I only want minima w.r.t reference bar not everything $\endgroup$ – TM90 Sep 12 '16 at 23:48
  • $\begingroup$ @TM90 You have not defined the bar in the question. If you do, selecting the local extrema outside of it is trivial. $\endgroup$ – Anton Antonov Sep 13 '16 at 0:05
  • $\begingroup$ yeah sure, I guess that will do. Thanks Mr Anton $\endgroup$ – TM90 Sep 13 '16 at 2:58


minima = TakeSmallestBy[#[[2]] &, 1] /@
             Pick[data, MinDetect[data[[All, 2]], 0.001], 1],
             #1[[1]] + 0.002 == #2[[1]] &
ListPlot[minima, PlotRange -> All]
Differences@Flatten[minima, 1][[All, 1]]

I used the threshold 0.001 to define the "reference bar." I also used the fact that the x-values in the data set were all exactly 0.002 apart to separate distinct minima.

MinDetect forms the basis of this approach. The rest is just list manipulation to isolate the minima and the associated x-values for finding distances.

| improve this answer | |
  • $\begingroup$ Thanks a lot Mr Josh Bishop, it does work. $\endgroup$ – TM90 Sep 13 '16 at 4:25
  • $\begingroup$ Good solution. (+1) $\endgroup$ – Anton Antonov Sep 13 '16 at 13:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.