Find peaks in a certain time interval

조회 수: 5 (최근 30일)
Giorgia Fusaroli
Giorgia Fusaroli 2021년 6월 25일
댓글: dpb 2021년 6월 25일
Hi everyone, i need your help :)
I have a real signal (called signal) with the relative time vector (called time) in which i have already found the major peaks:
M=max(signal);
[p,l]=findpeak(signal);
j = 1;
i = 1;
s = size(p,1);
for i = 1:s
if p(i) >= mn
peak (j) = p(i);
lock (j) = l(i);
j = j+1;
end
end
Now, i have to discharge the peaks which are detected in a distance lower than 0.5 s. and this point is where i have some issue, Because i don't know how to select the peaks starting by the location and the associate time.
I don't know if i am clear, if you need some more info im totally available, Someone can help me ?
  댓글 수: 1
dpb
dpb 2021년 6월 25일
Why don't you first investigate the various options available in findpeaks to screen peaks based on given criteria?
[p,l]=findpeaks(signal,t,'MinPeakDistance',0.5);
will not reutrn peaks within 500 msec of each other for you -- you must pass the time vector in the units in which the spacing distance is entered, here I assumed seconds.
Also, it is not good practice to use time as a variable; that aliases the builtin MATLAB time function; I used t above instead.
You'll want to plot the result and compare to ensure you're not filtering out those that you do want, but there's where I'd certainly suggest to start...
You may want to use other criteria instead or besides to refine the returned peaks before you begin writing searching code of your own...

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by