Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

heart rate variability

Status
Not open for further replies.

prasadadiga

Newbie level 2
Joined
Jul 19, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
india
Activity points
1,303
hi everyone
i'm new to matlab , i've my project on the hear rate variability analysis(only linear)! so can any give algorithm as how to do it ! please forgive my dumbness!
i've done the following code !
%% Start and Clear Variables
close all
clear all
clc

disp(' WELCOME ')
disp(' %%%%%%%')
disp('Program to calculate ECG beats')
disp('-------------------------------')

%% User Inputs
file_name=input('Enter the name of the file with extention:','s');
sample_freq=input('Enter the sampling frequency of the signal:');

%% Load file
data=csvread(file_name);

dr=length(data);
%disp(dr);
%for i=1:dr

%end
%mx=max(data);
%disp(mx);
for i=2:dr
b(1)=data(1);
b(i)=data(i)-data(i-1); %first differentiation
if(b(i)<0)
b(i)=-1*b(i); %rectification
end
end
for i=3:dr
c(1)=b(1);
c(2)=b(2);
c(i)=(b(i)+2*b(i-1)+b(i-2)/4); %smoothening
end
for i=2:dr
d(1)=c(1);
d(i)=c(i)-c(i-1); %second differntiation
if d(i)<0
d(i)=-1*d(i); %rectification !!
end
end
for i=3:dr
e(1)=d(1);
e(2)=d(2);
e(i)=(d(i)+2*d(i-1)+d(i-2)/4); %smoothening
end

for i=1:dr
f(i)=(c(i)+e(i))/2;

end
maximval=0;
for i=1:dr
if f(i)>maximval
maximval=f(i);
end
end
for i=1:dr
if f(i)>=(0.4*maximval)
g(i)=200;
else
g(i)=0;
end
end
k=1;
for i=2:dr
if g(i-1)==0 && g(i)==200
h(k)=i;
k=k+1;
end
end
subplot(2,1,1),plot(e);
subplot(2,1,2),plot(g);
lt=length(h);
disp(lt);
for i=1:(lt-1)
rrnt(i)=h(i+1)-h(i);

end
%for i=1:(lt-1)
%disp(rrnt(i));
%end

nnmean=mean(rrnt);
disp(nnmean);
stdnn=std(rrnt);
disp(stdnn);
rmsssd=sqrt(mean(diff(rrnt))^2);
disp(rmsssd);


prasad
 

Am getting error by implementing the above code. Wat to do?:???:

- - - Updated - - -

AS

??? Error using ==> mtimes
Inner matrix dimensions must agree.

Error in ==> ecg at 23
d = round(d0 * L / d0(15)); % Scale them to fit in length L




How to rectify this error...???
Please reply to vinodini_1992@yahoo.com
 

Probably it should be the indexing multiplication and division. Try to change '*' to '.*' and '/' to './'
i.e.
d = round(d0 * L / d0(15));
to
d = round(d0 .* L ./ d0(15));
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top