How to find troughs of a signal below a threshold

조회 수: 8 (최근 30일)
Leyla Elyasizad
Leyla Elyasizad 2023년 3월 6일
답변: Star Strider 2023년 3월 6일
I am trying to find troughs of a signal which are below a certain threshold
I tried findpeaks but its not working
findpeaks(-1*TrialLFP{1,iSession}(chan,:),'Threshold',sigma);
Is there any thresholding option for islocalmin function?
  댓글 수: 1
Jan
Jan 2023년 3월 6일
What are "throughs of a signal"? What does "is not working" mean explicitly?

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

답변 (1개)

Star Strider
Star Strider 2023년 3월 6일
Use the 'MinPeakHeight' name-value pair —
t = linspace(0, 2*pi, 500);
s = sin(2*pi*t) - sin(2*pi*0.1*t-0.45);
Threshold = -1.75;
[pks,locs] = findpeaks(-s, 'MinPeakHeight',-Threshold)
pks = 1×2
1.9576 1.9443
locs = 1×2
220 298
figure
plot(t, s)
hold on
plot(t(locs), s(locs), 'vr', 'MarkerFaceColor','r')
hold off
grid
ylim([-2.5 1.5])
yline(Threshold, '--m', 'Threshold')
.

카테고리

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