How to find peaks in a data vector?

1 vue (au cours des 30 derniers jours)
Kelvin Prado
Kelvin Prado le 30 Jan 2017
Commenté : Star Strider le 2 Fév 2017
Hello,
I have the following data
data = [9 12 8 11 10 10 11 12 11 11 12 8 11 9 9 12 8 11 10 12 8 11 12 8 11 10 18 20 10 18 20 24 28 30 31 32 33 33 34 33 32 34 35 32 33 31 30 37 38 39 40 39 40 38 37 40 41 38 37 36 33 32 34 35 32 33 31 30 32 34 31 30 28 26 25 23 20 18 15 12 11 10 10 11 12 11 11 9 12 8 11 10 12 8 9 11 7 9 10 7 3 4 2 1 5 4 3 7 8 9 10 5 4 6 11 12 8 11 12 12 13 14 15 12 13 15 15 16 17 18 19 17 16 15 19 20 21 20 18 17 16 19 21 18 20 24 28 30 31 32 33 30 31 35 36 38 40 42 41 41 42 46 48 47 45 42 40 41 43 40 39 39 38 36 32 34 31 30 28 26 25 23 20 18 15 12 11 10 12 8 9 11 7 9 10 12 11 10 11 10 11 12 11 11 9 12 8 11 10 10 11 12 11 11 9 12 8 11 10 14 15 18 17 16 15 18 19 14 15 17 18 19 20 21 19 18 17 16 15 14 12 15 15 15 16 17 18 18 19 20 20 20 21 19 17 16 17 18 19 22 24 26 29 30 35 37 40 42 44 44 46 48 48 49 50 50 51 52 53 51 52 55 58 57 51 56 57 52 50 49 52 52 51 49 48 46 46 42 43 45 41 42 40 41 43 40 38 37 34 32 28 25 19 15 14 13 12 8 5 3 7 8 9 11 12 10 7 9 14 13 11 10 8 5 4 3 5 7 8 9 10 12 11 6 8 10 7 6 8];
and I need to find exactly 3 peaks in these data, for example:
How can I do that?
Note 1: I always need to find 3 peaks (this value doesn't change), but the X and Y axis range may change.
Note 2: The last peak/curve will always be higher than the other two.
Note 3: I don't need to get the value itself, I need to get the index of the value.

Réponse acceptée

Star Strider
Star Strider le 30 Jan 2017
If you have the Signal Processing Toolbox, use the findpeaks function. It will do what you want. You will have to experiment with its name-value pair arguments to get the ‘correct’ result.
  6 commentaires
Kelvin Prado
Kelvin Prado le 2 Fév 2017
  • Thanks again Star Strider, I will try to use the fft to find the dominant peak and determine the 'MinPeakDistance'. It seems to be relatively easy (in Matlab) and I think it solves my problem.
  • Image Analyst, cause I need to create an algorithm that automatically finds the peaks. The user of my algorithm doesn't need to have a previous knowledge about the data it self, just need to know what time (X axis) each peak occurs.
  • Thanks Adam, I will take a look at the 'MinPeakProminence' attribute. I didn't know about that.
Star Strider
Star Strider le 2 Fév 2017
Our pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by