# How to handle ECG muscle noise artifacts correctly ?

11 views (last 30 days)
Spectro on 2 Apr 2021
Commented: Star Strider on 2 Apr 2021
I'm trying to process ECG recordings taken by Holter (bipolar chest leads) during simulations in virtual reality. Therefore, people move a lot when measuring so I often encounter movement and muscle artifacts. What is the best approach or what filter design should be used to efficiently suppress the EMG artifacts which overlap the R waves. I will be happy for any advice. Thank you in advance (attachment is sample of used signal). Star Strider on 2 Apr 2021
I would use a bandpass filter.
Example —
EKG = D.ecg;
L = numel(EKG);
Fs = 125; % Use Actual Sampling Frequency
tv = linspace(0, L, L)/Fs; % Time Vector
Fn = Fs/2;
EKGmc = EKG-mean(EKG);
FTEKG = fft(EKGmc)/L;
Fv = linspace(0, 1, fix(L/2)+1)*Fn;
Iv = 1:numel(Fv);
figure
plot(Fv, abs(FTEKG(Iv))*2)
grid
xlim([0 1])
title('Fourier Transform')
EKGfilt = bandpass(EKG, [0.03 0.2]);
figure
subplot(2,1,1)
plot(tv, EKG)
grid
title('Unfiltered')
subplot(2,1,2)
plot(tv, EKGfilt)
grid
ylim([-0.5 1.5])
title('Bandpass Filtered')
xlabel('t')
Use the Fourier transform plot to guide the filter design.
##### 2 CommentsShowHide 1 older comment
Star Strider on 2 Apr 2021
As always, my pleasure!
It is straightforward to design filters using command-line funcitons. I prefer elliptic filters (the ellip function and its firends) since it is computationally more efficent than the others.
That would go something like this:
Fs = 125;
Fn = Fs/2;
Wp = [0.03 0.2]/Fn;
Ws = Wp.*[0.95 1.05];
Rs = 50;
Rp = 1;
[n,Wn] = ellipord(Wp,Ws,Rp,Rs);
[z,p,k] = ellip(n,Rp,Rs,Wp);
[sos,g] = zp2sos(z,p,k);
figure
freqz(sos, 2^16, Fs)
set(subplot(2,1,1), 'XLim',[0 0.5])
set(subplot(2,1,2), 'XLim',[0 0.5])
EKGfilt = filtfilt(sos, g, EKG);
Use the corredct value for ‘Fs’. The rest automaticaly scales with it, so no other changes are necessary, unless the desired performance is different than in this filter.

R2021a

### Community Treasure Hunt

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

Start Hunting!