How do I filter out findpeak values using threshold from signal processing toolbox?

1 view (last 30 days)
So, I have a bunch of data that oscillates between positive and negative values and I need to find the peaks of this data. The problem I'm having is that I'm picking up smaller, unwanted peaks when I simply just want the max and min cycle.
For example - when I use findpeaks I return a [peak, location] matrices like this:
0.0947 14377
-0.1684 14434
0.1166 14498
-0.1716 14558
-0.1610 14568
0.1204 14623
-0.1547 14680
-0.1666 14691
0.1131 14745
0.1124 14867
-0.1724 14926
-0.1639 14935
0.1148 14987
-0.1516 15046
However, the matrices I need to return should alternate between positive and negative and return the max peaks like this:
0.0947 14377
-0.1684 14434
0.1166 14498
-0.1716 14558
0.1204 14623
-0.1666 14691
0.1131 14745
-0.1724 14926
0.1148 14987
-0.1516 15046
I've also tried the function findpeaks(data,'threshold',0.03) but this has only returned an empty [peak, location] matrix. I've also played around with the threshold values but nothing seems to work.
Essentially, if anyone could help me reduce the matrix to just the max peaks with alternating positive and negative values I would be extremely grateful!
Thanks!

Answers (1)

Star Strider
Star Strider on 6 Oct 2014
Without your data it’s difficult to be specific.
I would experiment with other findpeaks parameters, specifically the 'MINPEAKDISTANCE' parameter. Set it to the distance between the peaks (in integer index units) that you want so that it will skip the minor peaks.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!