Afficher commentaires plus anciens
I need assistance, actually I have a matrix b=2500x21, which is imaginary part of a FRF signal. I want to find peaks for every column, each column represents accelerometer response at different location of a beam. The following code i have written.
for i=1:21
pks(:,i)=findpeaks(b(:,i))
end
pks(:,i)=pks;
Problem is that, the matrix pks just stores last iteration value. I want that all the peak values after every iteration will be stored in a single matrix.
Can any body having suggestions?
8 commentaires
madhan ravi
le 31 Août 2018
Modifié(e) : madhan ravi
le 31 Août 2018
Just format the code using the code button. So that it’s easy for others to read your code.
Walter Roberson
le 31 Août 2018
After your for loop, i will be left at its last value, 21. Then your final statement there would be equivalent to
pks(:,21) = pks;
which tries to store the entire pks array into a single location in the pks array. I am having difficulty coming up with any circumstance under which that could work without giving an error message.
I suspect that the for loop will generate an error, as most of the time the different columns of signal will lead to a different number of peaks being found, leading to errors when you tried to store the different vector lengths into the same array.
Stephen23
le 31 Août 2018
What is the purpose of this?:
pks(:,i)=pks;
Ayisha Nayyar
le 31 Août 2018
Ayisha Nayyar
le 31 Août 2018
Stephen23
le 31 Août 2018
Hi jonas, I have attached the file, now follow the code and see the results please.
for i=1:21
pks(:,i)=findpeaks(b(:,i))
end
pks(:,i)=pks;
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Signal Operations 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!