How to add baseline drift to an ECG signal

9 vues (au cours des 30 derniers jours)
Sabaudian
Sabaudian le 19 Fév 2022
Modifié(e) : Image Analyst le 19 Fév 2022
I am at the beginning of the study of ECG signal processing and I am at the start of learning MATLAB. I cannot tell if I am doing the correct operations.
the image presented above presents the operations to be performed to add the baseline drift to the starting signal.
I don't know if it is wrong or not. But when I plot the signal with the addition of the baseline drift, it seems almost unchanged.
To perform these operations I used the signal found in this database (name of the file: 100m.mat)
(to download the file in the .mat version follow the link: https://archive.physionet.org/cgi-bin/atm/ATM to download the .mat version file follow the link: https://archive.physionet.org/cgi-bin/atm/ATM and select the database called "MIT-BIH Arrhythmia Database (mitdb) and select 100 as Record, than Toolbox and selcet export as .mat")
The one below is the code I wrote:
%% Original ECG Signal
load('100m.mat');
original_signal = val(1,:);
fs = 360; % Hz
% T = 1/fs;
L = length(original_signal);
t = (0 : L - 1)/fs;
plot(t, original_signal);
title('plot of the original ECG signal');
xlabel ('time [sec]');
ylabel ('ECG Amplitute [mV]');
grid on
%% Add Noise to the ECG signal
Noise = awgn(original_signal, 20, 'measured');
plot(t, Noise, 'b');
grid on
xlabel('time [sec]');
ylabel('ECG Amplitute [mV]');
title('ECG signal with added noise');
%% Add Baseline drift to ECG signal
x = linspace(0,2*pi,L);
A = 0.8;
N = 60;
BaselineDrift = A*cos(x./N);
subplot(2,1,1)
plot(t, Noise); % Noise is the original signal with noise add to it
xlabel('time [sec]');
ylabel('ECG Amplitute [mV]');
title("Noisy ECG Signal");
subplot(2,1,2)
Dirty_Signal = Noise + BaselineDrift;
plot(t, Dirty_Signal)
xlabel('time [sec]');
ylabel('ECG Amplitute [mV]');
title("Corrupted ECG Signal (Noise + Baseline Drift)");
Thanks in advance for the help

Réponse acceptée

Image Analyst
Image Analyst le 19 Fév 2022
That's not all the code. Where do you define L, t, and Noise?
Try
minDriftOffset = 0; % Whatever
maxDriftOffset = 10; % Whatever.
BaselineDrift = linspace(minDriftOffset, maxDriftOffset, length(Noise));
Dirty_Signal = Noise + BaselineDrift;
  5 commentaires
Image Analyst
Image Analyst le 19 Fév 2022
Modifié(e) : Image Analyst le 19 Fév 2022
Sorry I couldn't run it. awgn() requires the Communications Toolbox. But did you try my suggestion? If not, why not?
My code had the drift be a linear ramp while
BaselineDrift = A*cos(x./N);
has the drift be a cosine shape. You could combine both with
minDriftOffset = 0; % Whatever
maxDriftOffset = 10; % Whatever.
BaselineDrift = A * cos(x ./ length(Noise)) + linspace(minDriftOffset, maxDriftOffset, length(Noise));
Dirty_Signal = Noise + BaselineDrift;
Sabaudian
Sabaudian le 19 Fév 2022
I try it and it works thank. I hope it is consistent with what is presented in the document I plot above.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Single-Rate Filters dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by