How to find troughs of a signal below a threshold
7 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
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)
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')
.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!