Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Code including multiply embedded for loops with conditions

1 view (last 30 days)
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.

Answers (0)

This question is closed.

Tags

Community Treasure Hunt

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

Start Hunting!