Can anyone help me on implementing gaussian noise on an ecg signal? If you want i can share my code. The problem is gaussian noise is 0 always.
Show older comments
sig = 1/abs(Fs) for i = 1:L gauss(i) = exp(-(i*i)/(2*sig*sig))/(sig*sqrt(pi*2)); dist(i) = gauss(i)+ x(i); i end
subplot(2,1,2); plot(t(1:L),dist(1:L)) title('Dist ECG Signal')
Answers (2)
Fs = 1; L = 128;
x = zeros(L, 1); % This can be your original signal
sig = 1/abs(Fs); % std of Gaussian random noise
%{
for i = 1:L
% This is Gassian pdf function, not Gaussian distributed time series
gauss(i) = exp(-(i*i)/(2*sig*sig))/(sig*sqrt(pi*2));
dist(i) = gauss(i)+ x(i);
end
%}
y = x + randn(L,1) * sig; % signal + Gaussian noise (doc randn)
plot((1:L), y)
title('ECG Signal with Gaussian Noise added')
LO
on 11 Jul 2021
I tried to fit some params,
you can use the function wgn (white gaussian noise, see documentation)
Fs = 20000;
sig = 1/abs(Fs) ;
L = 100;
x= rand(1,1000);
t=[1:1000];
for i = 1:L
gauss(i) = exp(-(i*i)/(2*sig*sig))/(sig*sqrt(pi*2));
dist(i) = gauss(i)+ x(i);
i
end
noise = wgn(1000,1,0);
subplot(2,1,1);
plot(t(1:L),noise(1:L))
title('white gaussian noise ECG Signal')
subplot(2,1,2);
plot(t(1:L),dist(1:L))
title('Dist ECG Signal')
Categories
Find more on Signal Generation, Analysis, and Preprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!