Detect main part of a signal

32 次查看(过去 30 天)
Julio
Julio 2024-11-4,15:17
评论: Star Strider 2024-11-7,13:28
Hi, I would like to receive some help about one question:
Need to know how to detect the real signal in an EMG file (as image 1).
Till now, I know how to find the absolute center with this code:
[F, C]=size(D.data);
center=(F-mod(F,2))/2;
x=x(center-1500:center+1500,:);
and then I search results on both sides of that middle point, but as you can see, it doesn't return symetric values (image 2).
How can I add something to that code to detect the interesting area?
Thanks, regards

采纳的回答

Star Strider
Star Strider 2024-11-4,16:14
I usually use the envelope function, usually using the 'peak' option, and then test for the first instance of those (ususlly the upper envelope) exceds a ceertain threshold.
To illustrate —
Fs = 1E+3;
L = 60;
t = linspace(0, Fs*L, Fs*L+1).'/Fs;
EMG = randn(size(t))/10;
N = numel(t((t>=15 & t<=45)));
EMG(t>=15 & t<=45) = randn(N,1);
figure
plot(t, EMG)
grid
xlabel('Time')
ylabel('Amplitude')
title('Original')
[eu,ed] = envelope(EMG, 50, 'peak');
thrshld = max(eu(t>0 & t<5));
sigstart = find(eu >= thrshld*1.5, 1, 'first');
sigend = find(eu >= thrshld*1.5, 1, 'last');
figure
plot(t, EMG, DisplayName="Signal")
hold on
plot(t, eu, '-r', DisplayName="Upper Envelope")
hold off
grid
xline(t([sigstart sigend]), '--k', LineWidth=2, DisplayName="Signal Borders")
xlabel('Time')
ylabel('Amplitude')
title('Original With upper Envelope & Signal Borders')
legend('Location','best')
.
  2 个评论
Julio
Julio 2024-11-7,13:17
移动:Star Strider 2024-11-7,13:27

Thank you!

Star Strider
Star Strider 2024-11-7,13:28
As always, my pleasure!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by