MATLAB Answers

how to contaminate ecg signal with noise

21 views (last 30 days)
sai lakshmi
sai lakshmi on 16 Nov 2019
Commented: Daniel M on 23 Nov 2019
I am working on the project namely "FALSE ALARM REDUCTION IN ATRIAL FIBRILLATION DETCTION USING DEEP BELIEF NETWORKS".
In this i need to download two databases, namely 07910m.mat{MIT_BIH ATRIAL FIBRILLATION DATABASE} which is attached here,and also the 'em' recording {MIT_BIH NOISE STRESS TEST DATABASE} is attached.
The afib database has Fs=250Hz and 10h in length,and 'em' recording is 30 min and has Fs=360Hz
now i need to make the 'em' recording 10h in length
in the paper its told that i can be done using auto regressive model,iam not knowing how to do it
can anyone suggest me the coding for thisscreenshot.png

  11 Comments

Show 8 older comments
sai lakshmi
sai lakshmi on 20 Nov 2019
Known epsilon(n) (1*1000000)which is a white noise defined earlier,also psi(I) is also defined earlier which are AR coefficients.now I need to execute the summation inside a for loop of finding x(n)
Daniel M
Daniel M on 20 Nov 2019
Well you know there will be a loop involved. Can you show me the code you currently have? I can help you get there.
sai lakshmi
sai lakshmi on 20 Nov 2019
load('07910m.mat');
x1=(val(1,:))/200;
n=length(x1);
fs=250;
t=0:1/fs:(n-1)/fs;
%plot(t,x1);
%[qrs_amp_raw,qrs_i_raw,delay]=pan_tompkin(x1,fs,0);
load('emm.mat');
x2=(val(1,:));
Fs=360;
x3=resample(x2,25,36);
figure(1);
subplot(2,1,1);
plot(x2);
subplot(2,1,2);
plot(x3);
[d1,p1,rc] = aryule(x3,20);
for c=1:20
psi(c)=d1(c+1);
end
zmwn=randn(size(x1));
z=double.empty(0,1000000);
for i=1:length(x1)
z(i)=(-1.8909*z(i-1)+1.2973*z(i-2)-0.7229*z(i-3)+0.4524*z(i-4)-0.2636*z(i-5)+0.2620*z(i-6)-0.2307*z(i-7)+0.2164*z(i-8)-0.8175*z(i-9)+0.1536*z(i-10)-0.1285*z(i-11)+0.0878*z(i-12)-0.0736*z(i-13)+0.0682*z(i-14)-0.0679*z(i-15)+0.0487*z(i-16)-0.0268*z(i-17)+0.0249*z(i-18)-0.0153*z(i-19)+0.0026*z(i-20))+zmwn(b);
end
I am getting an error "subscript indices must be either of positive values or logicals"
I understood the occurence for error,but am not recognizing of how to simulate the noise signal in this.

Sign in to comment.

Answers (2)

Daniel M
Daniel M on 20 Nov 2019
Edited: Daniel M on 21 Nov 2019
I obviously cannot run this code because I don't have the data nor any of the associated functions. By the way, you are getting an error because you are trying to access z at negative index locations.
Here is an example of how you would plot the equation. Keep in mind the assumptions I've made, which I've tried to comment.
clearvars
clc
sz = [1 1000];
e = randn(sz); % epsilon
X = nan(sz); % preallocate
X(1) = 0; % set first value. Don't know what this should be.
c = 1; % a constant, don't know what this should be
p = 5; % set the order of the model. Don't know what this should be.
% note that p cannot be greater than the iterating variable of the loop
% otherwise, it would try to access negative index locations
% So, either initialize your loop index at a value greater than 2 (and have the starting values of X)
% or do it this way, using increasing values of p, up to n-1
phi = rand(1,p); % your values of phi
for n = 2:sz(2)
ii = 1:min(p,n-1); % see the note above
sigma = dot(phi(ii), X(n-ii)); % sum of the products of the elements
X(n) = c + sigma + e(n);
end

  7 Comments

Show 4 older comments
Daniel M
Daniel M on 22 Nov 2019
Sai I noticed you unaccepted the answer citing it did not work for you. What is not working? This is the code for how to implement that equation. Just because you don't know how to use it does not mean the answer is incorrect.
sai lakshmi
sai lakshmi on 23 Nov 2019
the values of X are recorded as infinity!
so thought it wouldn't work.
Daniel M
Daniel M on 23 Nov 2019
Did you not see my response that phi must be << than 1? Did you even try it? It works.

Sign in to comment.


sai lakshmi
sai lakshmi on 21 Nov 2019
I have provided the databases at the top of the question as links,please check it once and provide me with the required coding.

  1 Comment

Daniel M
Daniel M on 22 Nov 2019
I think you're looking for a consultant.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by