Findpeaks and maxk without sorting
Afficher commentaires plus anciens
Dear all,
The 'Pilant_Vy_envR' (xlsx) file is of these dimensions: 1200x600. Every column is a signal, and i would like to find the three main peaks (non sorted) in every column. I'm stuck with the following code:
ncolVy=size(Pilant_Vy_envR,2);
max = zeros(ncolVy,3) ;
for l = 1:ncolVy
[PKSVy,locs] = findpeaks(Pilant_Vy_envR(:,l));
maxvy(l,:) = maxk(PKSVy,3);
MaxVy = maxvy.';
end
The output contain 3x600 columns. Three are the maxima obtained by every signal, but the code above sort them. I would like infact to obtain the peaks as they are in the graph.
So for example for the first signal (first column) i would like the peaks with their order:

But with maxk i have the peaks with the order:1-3-2.
Can someone help me?
Best regards.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Descriptive Statistics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!