Detect main part of a signal

32 visualizaciones (últimos 30 días)
Julio
Julio el 4 de Nov. de 2024 a las 15:17
Comentada: Star Strider el 7 de Nov. de 2024 a las 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

Respuesta aceptada

Star Strider
Star Strider el 4 de Nov. de 2024 a las 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 comentarios
Julio
Julio el 7 de Nov. de 2024 a las 13:17
Movida: Star Strider el 7 de Nov. de 2024 a las 13:27

Thank you!

Star Strider
Star Strider el 7 de Nov. de 2024 a las 13:28
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by