Need help to removing motion (breathing?) artifact from ECG signal
I have this single-channel ECG signal with motion artifacts (I believe from breathing).
I’ve tried several filters, but none have given me a good output.
Not being an expert, I followed the instructions from Kher, 2019 with this code, but a compatibility issue (since I am using version 2018b) prevents me from obtaining any results; by changing some commands the result is unsuitable:
y1 = load(‘EKG.mat’);
y2= (y1 (:,1)); % ECG signal data
a1= (y1 (:,1)); % accelerometer x-axis data
a2= (y1 (:,1)); % accelerometer y-axis data
a3= (y1 (:,1)); % accelerometer z-axis data
y2 = y2/max(y2);
Subplot (3, 1, 1), plot (y2), title (‘ECG Signal with motion artifacts’), grid on
a = a1+a2+a3;
a = a/max(a);
mu= 0.0008;
%Hd = adaptfilt.lms(32, mu); %original command
Hd = dsp.LMSFilter(‘Length’, 32, ‘StepSize’, mu);
% [s2, e] = filter(Hd, a, y2); % original command, don’t work in 2018b version
[s2, e] = Hd(a, y2); % command adapted
fig = figure
subplot (3, 1, 2)
plot (s2)
title (‘Noise (motion artifact) estimate’)
grid on
subplot (3, 1, 3)
plot (e)
title (‘Adaptively filtered/ Noise free ECG signal’)
grid on
I also tried filtering in this other way, but the result is very poor.
ecg_signal = load(‘EKG.mat’);
Fs = 256;
t = (0:length(ecg_signal)-1) / Fs;
fc = 45; % cut frequency
[b, a] = butter(4, fc / (Fs / 2), ‘low’);
% filter
ecg_filtered = filtfilt(b, a, ecg_signal);
With simple low-pass or high-pass filters I wasn’t able to obtain at least acceptable results.
If anyone can help me?
thank you in advanceI have this single-channel ECG signal with motion artifacts (I believe from breathing).
I’ve tried several filters, but none have given me a good output.
Not being an expert, I followed the instructions from Kher, 2019 with this code, but a compatibility issue (since I am using version 2018b) prevents me from obtaining any results; by changing some commands the result is unsuitable:
y1 = load(‘EKG.mat’);
y2= (y1 (:,1)); % ECG signal data
a1= (y1 (:,1)); % accelerometer x-axis data
a2= (y1 (:,1)); % accelerometer y-axis data
a3= (y1 (:,1)); % accelerometer z-axis data
y2 = y2/max(y2);
Subplot (3, 1, 1), plot (y2), title (‘ECG Signal with motion artifacts’), grid on
a = a1+a2+a3;
a = a/max(a);
mu= 0.0008;
%Hd = adaptfilt.lms(32, mu); %original command
Hd = dsp.LMSFilter(‘Length’, 32, ‘StepSize’, mu);
% [s2, e] = filter(Hd, a, y2); % original command, don’t work in 2018b version
[s2, e] = Hd(a, y2); % command adapted
fig = figure
subplot (3, 1, 2)
plot (s2)
title (‘Noise (motion artifact) estimate’)
grid on
subplot (3, 1, 3)
plot (e)
title (‘Adaptively filtered/ Noise free ECG signal’)
grid on
I also tried filtering in this other way, but the result is very poor.
ecg_signal = load(‘EKG.mat’);
Fs = 256;
t = (0:length(ecg_signal)-1) / Fs;
fc = 45; % cut frequency
[b, a] = butter(4, fc / (Fs / 2), ‘low’);
% filter
ecg_filtered = filtfilt(b, a, ecg_signal);
With simple low-pass or high-pass filters I wasn’t able to obtain at least acceptable results.
If anyone can help me?
thank you in advance I have this single-channel ECG signal with motion artifacts (I believe from breathing).
I’ve tried several filters, but none have given me a good output.
Not being an expert, I followed the instructions from Kher, 2019 with this code, but a compatibility issue (since I am using version 2018b) prevents me from obtaining any results; by changing some commands the result is unsuitable:
y1 = load(‘EKG.mat’);
y2= (y1 (:,1)); % ECG signal data
a1= (y1 (:,1)); % accelerometer x-axis data
a2= (y1 (:,1)); % accelerometer y-axis data
a3= (y1 (:,1)); % accelerometer z-axis data
y2 = y2/max(y2);
Subplot (3, 1, 1), plot (y2), title (‘ECG Signal with motion artifacts’), grid on
a = a1+a2+a3;
a = a/max(a);
mu= 0.0008;
%Hd = adaptfilt.lms(32, mu); %original command
Hd = dsp.LMSFilter(‘Length’, 32, ‘StepSize’, mu);
% [s2, e] = filter(Hd, a, y2); % original command, don’t work in 2018b version
[s2, e] = Hd(a, y2); % command adapted
fig = figure
subplot (3, 1, 2)
plot (s2)
title (‘Noise (motion artifact) estimate’)
grid on
subplot (3, 1, 3)
plot (e)
title (‘Adaptively filtered/ Noise free ECG signal’)
grid on
I also tried filtering in this other way, but the result is very poor.
ecg_signal = load(‘EKG.mat’);
Fs = 256;
t = (0:length(ecg_signal)-1) / Fs;
fc = 45; % cut frequency
[b, a] = butter(4, fc / (Fs / 2), ‘low’);
% filter
ecg_filtered = filtfilt(b, a, ecg_signal);
With simple low-pass or high-pass filters I wasn’t able to obtain at least acceptable results.
If anyone can help me?
thank you in advance filter, artifact MATLAB Answers — New Questions