Emg Signal analysis, Mean value filter Threshold analysis
Afficher commentaires plus anciens
Hello all,
I need your help. I have changed my course of study and have just started programming. Now I have to hand in a code by tomorrow morning and present the charts on Tuesday. I have received a code from a fellow student, which I do not understand and need to change.
It is about analyzing the Emg measurement data. To do a threshold analysis preferably with a for loop and say at what points the muscle is active. Either over time or test a value. There was something about squaring and amount.
I want to learn it, unfortunately it was all way too fast. I don't have enough programming knowledge for it yet.
I would really appreciate your help because I am completely desperate.
I already doubt my decision and my personality.
I thank all who have read the post at least to this point....
clear all;
close all;
% Laden der Messdaten
load('Romanov (ABMT).mat');
% Definition der Variablen
F = 2000; % Abtastfrequenz in Hz
T = 1/F; % Abtastperiode in s; T = 1/2000
K = length(data(:,1)); % Länge der Datenpunkte
t = [0:K-1]*T; % Abtastzeitpunkte
f = [0:1/(K-1):1]*F; % Frequenzstützstellen
N = 3000; % Ordnung, Sampellänge
FG = 40; % Grenzfrequenz
emg1 = data(:,1); % Daten der ersten Spalte
EMG1 = fft(emg1); % Fast Fourier Transformation der EMG_1-Daten
aTP = fir1(N,FG/(F/2)); % Berechnung TP Filterkoeffizienten
emg1TP = filter(aTP,1,emg1); % Mittelwertbildung über (NMittel+1)- Werte
NMittel = 1000; % Filterordnung eines FIR-Mittelwertfilters
aMittel = ones(1,NMittel+1);
emg1envelopMittel = sqrt(filter(aMittel,1,emg1TP.^2) / (NMittel+1));
% emg1envelopMittel = filter(aMittel,1,abs(emg1TP)) / (NMittel+1);
d = designfilt('bandstopiir','FilterOrder',2, ...
'HalfPowerFrequency1',49,'HalfPowerFrequency2',51, ...
'DesignMethod','butter','SampleRate',F);
fvtool(d,'Fs',F);
filtered = filtfilt(d,emg1);
subplot(111), plot(f,abs(EMG1),'b',f,abs(filtered),'r');
xlim([0 F/2]);
xlabel('f in Hz');
ylabel('|EMG_1(f)|');
xlabel('f in Hz');
legend('Unfiltered','Filtered');
title('Spektralverlauf des EMG-Signals');
figure;
plot(t,emg1,t,filtered,t,emg1envelopMittel,'k',t,-emg1envelopMittel,'k');
xlabel('t in s');
ylabel('emg_1(t), gefiltert und Einhüllende in mV');
grpdelay(d,N,F)
delay = mean(grpdelay(d))
figure;
plot(t,emg1,t,filtered,t - delay,emg1envelopMittel,'k',t- delay,-emg1envelopMittel,'k')
xlabel('t in s');
ylabel('emg_1(t), ungefiltert und Einhüllende in mV');
3 commentaires
Star Strider
le 6 Nov 2022
It will be necessary for you to provide the .mat file (and a description of its contents) and a description of what the analysis is intended to accomplish.
Lisa
le 6 Nov 2022
Déplacé(e) : Star Strider
le 6 Nov 2022
Lisa
le 6 Nov 2022
Modifié(e) : Walter Roberson
le 6 Nov 2022
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Spectral Measurements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
