Processing EMG data in MATLAB?

160 views (last 30 days)
Tom Nickolay
Tom Nickolay on 25 Feb 2020
Commented: SURYAKALA on 11 Aug 2024
Hi all,
I am VERY new to MATLAB, so please excuse my ignorance if this is a very novice problem. I am analysing EMG signals, I have imported from my data from xlsx as time (X) and voltage (y).
After extracting data;
set(0, 'defaultFigureToolbar', 'none')
% RAW_DATA_EXTRACTION
%% BACK_SQUAT
%%% VISIT_ONE
T1_10rm_BS_1 = xlsread('T1_70%_10rm_BS_1.xlsx','Sheet3','A5:E77494');
time = T1_10rm_BS_1(:,1);
BS_RF_1 = T1_10rm_BS_1(:,4);
BS_BF_1 = T1_10rm_BS_1(:,5);
T1_10rm_BS_2 = xlsread('T1_70%_10rm_BS_2.xlsx', 'Sheet4','A5:E78394');
time = T1_10rm_BS_2(:,1);
BS_RF_2 = T1_10rm_BS_2(:,4);
BS_BF_2 = T1_10rm_BS_2(:,5);
running filters;
%FILTER
% Lowpass filter 500Hz
Freq = 1500;
NyqFreq = Freq/2;
Lowpass = 500;
Wn = Lowpass/NyqFreq;
[B,A] = butter (4,Wn,'low');
% run filter
BS_RF_1_low_filtered = filtfilt(B,A,BS_RF_1);
BS_BF_1_low_filtered = filtfilt(B,A,BS_BF_1);
BS_RF_2_low_filtered = filtfilt(B,A,BS_RF_2);
BS_BF_2_low_filtered = filtfilt(B,A,BS_BF_2);
% Highpass filter 10Hz
Highpass = 10;
Wo = Highpass/NyqFreq;
[D,C] = butter (4,Wo,'high');
% run filter
high_pass_BS_RF_1_filtdata = filtfilt(D,C,BS_RF_1_low_filtered);
high_pass_BS_BF_1_filtdata = filtfilt(D,C,BS_BF_1_low_filtered);
high_pass_BS_RF_2_filtdata = filtfilt(D,C,BS_RF_2_low_filtered);
high_pass_BS_BF_2_filtdata = filtfilt(D,C,BS_BF_2_low_filtered);
% Full wave rectification of EMG
filtered_BS_RF_1 = abs(high_pass_BS_RF_1_filtdata);
filtered_BS_BF_1 = abs(high_pass_BS_BF_1_filtdata);
filtered_BS_RF_2 = abs(high_pass_BS_RF_2_filtdata);
filtered_BS_BF_2 = abs(high_pass_BS_BF_2_filtdata);
% Linear envelope (2Hz lowpass)
LP = 2;
Wp = LP/NyqFreq;
[F,E] = butter (4,Wp,'low');
linear_BS_RF_1 = filtfilt(F,E,filtered_BS_RF_1);
linear_BS_BF_1 = filtfilt(F,E,filtered_BS_BF_1);
linear_BS_RF_2 = filtfilt(F,E,filtered_BS_RF_2);
linear_BS_BF_2 = filtfilt(F,E,filtered_BS_BF_2);
and generating my plot (for BS_RF_1);
I am now struggling to try and find the area under the curve for my set of 10 repetitions.
I am looking to define mean activation and peak activation.
All constructive help welcome,
Cheers.
  4 Comments
David
David on 4 Sep 2022
I'm also stuck in the same EMG signals assignment. Did you complete that assignment ?
If you did, can you please share the code here. It'd be very helpful.
SURYAKALA
SURYAKALA on 11 Aug 2024
NO i also want the EMG signal for my miniproject but i did not yet have the perfect code for it if you have any EMG code please share it .its very help ful for me

Sign in to comment.

Accepted Answer

Aquatris
Aquatris on 25 Feb 2020
Edited: Aquatris on 25 Feb 2020
I think you are looking for the function cumtrapz, here is the link.

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!