1
$\begingroup$

I've been reading many posts about how to use FindPeaks. I am working with some GPX data and was looking to plot an elevation profile with points at the peaks and troughs, potentially with those locations shown as a text object. I was not able to use the information to get this to work, so hoping for some help. I've posted the .csv file here https://drive.google.com/file/d/1WjqlH-LV8333DSr9_YBsrQtn3vxZ7zjk/view?usp=sharing

FYI, these are distances and elevations between Antelope Wells New Mexico and Hachita New Mexico. Best case scenario would be a ListLinePlot with labelled points at the SIGNIFICANT peaks and troughs.

Any hints/advice/help is appreciated.

$\endgroup$

2 Answers 2

5
$\begingroup$

You can first smooth your data using a filter and then call "FindPeaks". Here is an example:

d = Import["d:/downloads/data.csv"];
da = d[[All, 2]];
da = LowpassFilter[da, 0.1];

peaks = FindPeaks[da][[All, 1]];
ListPlot[d, Epilog -> {Red, Point[d[[peaks]]]}]

enter image description here

For troughs you do the same with inverted data.

$\endgroup$
2
$\begingroup$
peaks = Pick[data, PeakDetect[data[[All, 2]], 2, .05], 1]
trs = Pick[data, PeakDetect[-data[[All, 2]], 2, .05], 1]
ListPlot[{data, peaks, trs}, 
 PlotStyle -> {Blue, {AbsolutePointSize[5], 
    Red}, {AbsolutePointSize[5], Darker@Green}}]

enter image description here

I have used the method presented in 54757.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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