function [QRS RR_interval TP TPprum]= QRSdetekce(signal,fvz)

N=length(signal);

b=fir1(200,[11*2/fvz 20*2/fvz],'bandpass');
signal1 = filter(b,1,signal);clear b;
signal1=signal1(101:end);

sig_moc = signal1.^2;

b=fir1(200,[0.5*2/fvz 1*2/fvz],'bandpass');
sig_moc_dol = filter(b,1,sig_moc);clear b;
sig_moc_dol=sig_moc_dol(101:end);

clear b;

QRS= [0 ; 0];a=0;
for i=2:1:length(sig_moc_dol)-1
    if sig_moc_dol(i-1)<sig_moc_dol(i)&&sig_moc_dol(i)>sig_moc_dol(i+1);
         if sig_moc_dol(i)>(0.5*max(sig_moc_dol));
            a=a+1;
            QRS(1,a) = 26000;
            QRS(2,a) = i;
         end       
    end
end

QRS_k = zeros(1,length(sig_moc_dol)-2);

a=0;

RR_interval = diff(QRS(2,:));

TP =((RR_interval./(60*fvz)).^-1);

TPprum = sum(TP)/length(TP);















