Finding very high and low data peaks using Matlab

I have a dataset and would like to find the top and bottom peaks. In Matlab, I try to execute a command findpeaks, but the result is strange.

Here is my simple code:

 [pks,locs] = findpeaks(Data);
 plot(locs,pks,'or')

and here is the result: enter image description here

Can someone guide me on how I can only find the top and bottom data peaks?

+4
source share
1 answer

You can use an additional input MinPeakProminenceto tell Matlab just for viewing, yes, well-known peaks.

[pks,locs] = findpeaks(Data,'MinPeakProminence',4);
 plot(locs,pks,'or')

You can play with the option and see what works best for you.

+2
source

All Articles