Effacer les filtres
Effacer les filtres

Findpeaks with multiple columns

6 vues (au cours des 30 derniers jours)
HC98
HC98 le 14 Fév 2022
So I have an array which is sized at 2000 x 100, called bdata. I want to use findpeaks to determine the peaks in every column of this array. I tried the following:
for g = 2:size(bdata,2)
[pk,loc] = findpeaks(bdata(:,g));
P{g} = [pk loc];
end
But it keeps calculating wrong values and even values not in bdata...
  2 commentaires
Mathieu NOE
Mathieu NOE le 14 Fév 2022
hello
can you share the data as well and explain what you expect ?
Mathieu NOE
Mathieu NOE le 16 Fév 2022
hello
so , problem solved ?

Connectez-vous pour commenter.

Réponses (1)

Star Strider
Star Strider le 16 Fév 2022
I am not certain what the data are, and without the data an appropriate solution is not possible.
However, there are two observations:
1. The findpeaks call in the question will return the indices of the peaks, not the independent variable value corresponding to those peaks. Finding that however is straightforward — simply use the ‘locs’ result to index into it.
2. The easiest way to be certain that findpeaks returns the desired peak is to use one or more of the name-value pair arguments. The one I use most is 'MinPeakProminence' since it invariably works and is relatively independent of the actual peak height. The 'MinPeakDistance' name-value pair can also help isolate the correct peak.

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by