Skip to content
Snippets Groups Projects
Commit 50a886d4 authored by marwan's avatar marwan
Browse files

several small bug fixes which improves the precision

parent 076491ba
No related branches found
No related tags found
No related merge requests found
......@@ -135,6 +135,9 @@ function xout=crqa(varargin)
% $Revision$
%
% $Log$
% Revision 5.13 2005/04/01 12:19:51 marwan
% bug in minimal length for diagonal and vertical lines fixed
%
% Revision 5.12 2005/03/16 13:16:12 marwan
% bug in output fixed (same time scales for all sub-plots)
%
......@@ -934,25 +937,32 @@ catch
if nogui~=2 & ishandle(hw), close(hw), end
end
N=size(X);
if theiler_window > 0
X_theiler=double(triu(X,theiler_window))+double(tril(X,-theiler_window));
else
X_theiler=X;
end
% compute recurrence times of 1st and 2nd type
errcode=20;
t1=[0];t2=[];
for i2=1:size(X,2)
rps2=find(diff(double(X(:,i2)))==1);
rps=find(X(:,i2));
for i2=1:size(X_theiler,2)
if(Nx-w < 2), waitbar(i2/size(X_theiler,2)), end
rps2=find(diff(double(X_theiler(:,i2)))==1);
rps=find(X_theiler(:,i2));
t1=[t1;diff(rps)];
t2=[t2;diff(rps2)];
end
t1=mean(t1);
t2=mean(t2);
N=size(X);
X_theiler=double(triu(X,theiler_window))+double(tril(X,-theiler_window));
[a b]=dl(X_theiler);
warning off
errcode=201;
b(find(b<lmin))=[];
[c d]=tt(X);
[c d]=tt(X_theiler);
warning off
errcode=202;
d(find(d<vmin))=[];
......@@ -960,7 +970,7 @@ d(find(d<vmin))=[];
errcode=203;
RR=sum(X_theiler(:))/(N(1)*N(2));
%b(find(b>=max(N)-lmin))=[]; if isempty(b), b=0; end
b(find(b>=max(N)))=[]; if isempty(b), b=0; end
if isempty(b), b=0; end
errcode=204;
if sum(sum(X_theiler)) > 0
DET=sum(b)/sum(sum(X_theiler));
......@@ -969,14 +979,15 @@ else
end
errcode=205;
L=mean(b);
histL=hist(b(:));
histL=hist(b(:),[1:min(N)]);
ENTR=entropy(histL(:));
errcode=206;
if sum(d)>0
LAM=sum(d)/sum(sum(X));
LAM=sum(d)/sum(sum(X_theiler));
else
LAM=NaN;
end
errcode=207;
TT=mean(d);
b=[b;0]; Lmax=max(b);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment