Message Boards Message Boards

Highest peak using FindPeaks?

Posted 1 year ago

Good morning to everyone. I have a set of data that is named data13. I need to extract peaks that are higher than a certain value named TWS. data13

I used this function that works, but in data13 have different local peaks.

PEA1 = FindPeaks[data13, 0, 0, TWS];

I receive as answers all the peaks that are higher than TWS.
Is it possible to have only the highest one, over for example a certain length?

Thank you very much for your help.

POSTED BY: Bruno Vusini
2 Replies

Hi Bruno,

Here is an example with fake data:

There will certainly be other possibilities, but maybe this will help?

fakedata = {10, 11, 14, 2, 15, 30, 30, 45, 12, 20, 24, 22, 35, 30, 30, 45}; findpeaks = FindPeaks[fakedata] p1 = ListLinePlot[fakedata, ImageSize -> Small, Frame -> True, GridLines -> Automatic]; p2 = ListPlot[ Tooltip[findpeaks, TooltipStyle -> {12, Bold, Red, Background -> LightGreen}] , Frame -> True , GridLines -> Automatic , ImageSize -> Small , PlotMarkers -> Style["[Bullet]", FontSize -> 25, Red] ]; Show[p1, p2, Frame -> True, PlotLabel -> "All peaks", LabelStyle -> Directive[Black, 8]]; enter image description here

Now we select and plot peaks above 40:

select40Above = Select[findpeaks, Last[#] > 40 &]; p3 = ListPlot[ Tooltip[select40Above, TooltipStyle -> {12, Bold, Red, Background -> LightGreen}] , Frame -> True , GridLines -> Automatic , ImageSize -> Small , PlotMarkers -> Style["[Bullet]", FontSize -> 25, Red] ]; Show[p1, p3, Frame -> True, PlotLabel -> "Peaks above 40 only", LabelStyle -> Directive[Black, 8]]

enter image description here

Best Regards,.....Jos

POSTED BY: Jos Klaps

Hi Bruno,

Can you support us with the data and more details?

Regards,…Jos

POSTED BY: Jos Klaps
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract