Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Code including multiply embedded for loops with conditions

1 vue (au cours des 30 derniers jours)
Manolis Michailidis
Manolis Michailidis le 9 Nov 2015
Clôturé : MATLAB Answer Bot le 20 Août 2021
Hello, i have a signal (nfo) and having found its peaks (pks) and minima (val) i should do the following : If it starts with peak (R0), then for the next peak (R1) if the next minima (K2) < previous (K1) then delete previous(K1,R1) , else delete next(R1,K2) , see the attached photo for better explanation. I have done some code but i get confused in the part than i compare with the previous (K1,R1) , here is my code
for kk=2:length(pks)-1
if pks(kk)<pks(kk+1)
tpks(kk)=pks(kk+1);
tl1(kk)=l1(kk+1);
end
end
tpks=tpks(tpks~=0);
tl1=tl1(tl1~=0);
If my signal starts with minima well the idea is similar (see photo).
Note pks are the peaks data, l1 the location of the peaks , val the minima and l2 the locations of minima. Any help appreciated thanks in advance.

Réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by