find local max in time window
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hasan alomari
am 26 Apr. 2017
Beantwortet: Hasan alomari
am 5 Mai 2017
am trying to find the local max in time window , i know that I have to define part from the signal then use the findpeaks built in function then take the max value of it.
% code
pks_value=[];this to store the max value from the peaks
step=200;
pcg=pcg_lp2';
for i=1:200:N
temp=pcg(i:i+step);
[pks,locs] = findpeaks(temp);
pks_value(i)=max(pks);
end
it give me the error msg "Index exceeds matrix dimensions. " so how to fix it , what to change
0 Kommentare
Akzeptierte Antwort
Greg Dionne
am 2 Mai 2017
If you have a recent copy of MATLAB, try using movmax().
2 Kommentare
Greg Dionne
am 4 Mai 2017
This should get you started:
x = randi(10,150,1);
tmp = movmax(x,5);
imvmax = find(x==tmp);
mvmax = x(imvmax);
plot(1:length(x),x,'-',imvmax,mvmax,'o')
Weitere Antworten (1)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!