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

bug fix for sparse CRP matrices

lmin option added
parent cfb4fcec
No related branches found
No related tags found
No related merge requests found
...@@ -11,11 +11,13 @@ function out=crqad(varargin) ...@@ -11,11 +11,13 @@ function out=crqad(varargin)
% monotonically increasing, it will be used as an % monotonically increasing, it will be used as an
% time scale for plotting. % time scale for plotting.
% %
% Y=CRQAD(X,M,T,E,W) computes the recurrence % Y=CRQAD(X,M,T,E,W,LMIN) computes the recurrence
% quantification analysis of the recurrence plot % quantification analysis of the recurrence plot
% of X by using the dimension M, delay T, the % of X by using the dimension M, delay T, the
% size of neighbourhood E, for the diagonals within % size of neighbourhood E, for the diagonals within
% the range [-W,W] around the main diagonal. % the range [-W,W] around the main diagonal. Variable LMIN
% sets the minimal length of what should be considered
% to be a diagonal line.
% %
% Parameters: dimension M, delay T, the size of % Parameters: dimension M, delay T, the size of
% neighbourhood E and the range size W are the first % neighbourhood E and the range size W are the first
...@@ -75,6 +77,9 @@ function out=crqad(varargin) ...@@ -75,6 +77,9 @@ function out=crqad(varargin)
% $Revision$ % $Revision$
% %
% $Log$ % $Log$
% Revision 2.10 2010/06/30 12:03:02 marwan
% Help text modified
%
% Revision 2.9 2009/03/24 08:35:19 marwan % Revision 2.9 2009/03/24 08:35:19 marwan
% corrected XCF calculation % corrected XCF calculation
% %
...@@ -107,7 +112,7 @@ global props ...@@ -107,7 +112,7 @@ global props
init_properties init_properties
lmin=10; lmin_default=2;
w=[]; method='max'; method_n=1; t=1; m=1; e=.1; w=[]; method='max'; method_n=1; t=1; m=1; e=.1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% check the input %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% check the input
...@@ -193,13 +198,13 @@ splash_gpl('crp'); ...@@ -193,13 +198,13 @@ splash_gpl('crp');
if ~isempty(varargin{i_double(3)}), t=varargin{i_double(3)}(1); else t=1; end if ~isempty(varargin{i_double(3)}), t=varargin{i_double(3)}(1); else t=1; end
if ~isempty(varargin{i_double(4)}), e=varargin{i_double(4)}(1); else e=.1; end if ~isempty(varargin{i_double(4)}), e=varargin{i_double(4)}(1); else e=.1; end
if ~isempty(varargin{i_double(5)}), w=varargin{i_double(5)}(1); else w=varargin{i_double(5)}; end if ~isempty(varargin{i_double(5)}), w=varargin{i_double(5)}(1); else w=varargin{i_double(5)}; end
% if ~isempty(varargin{i_double(6)}), wstep=varargin{i_double(6)}(1); else wstep=1; end if ~isempty(varargin{i_double(6)}), lmin=varargin{i_double(6)}(1); else lmin=lmin_default; end
else else
if ~isempty(varargin{i_double(3)}), m=varargin{i_double(3)}(1); else m=1; end if ~isempty(varargin{i_double(3)}), m=varargin{i_double(3)}(1); else m=1; end
if ~isempty(varargin{i_double(4)}), t=varargin{i_double(4)}(1); else t=1; end if ~isempty(varargin{i_double(4)}), t=varargin{i_double(4)}(1); else t=1; end
if ~isempty(varargin{i_double(5)}), e=varargin{i_double(5)}(1); else e=.1; end if ~isempty(varargin{i_double(5)}), e=varargin{i_double(5)}(1); else e=.1; end
if ~isempty(varargin{i_double(6)}), w=varargin{i_double(6)}(1); else w=varargin{i_double(6)}; end if ~isempty(varargin{i_double(6)}), w=varargin{i_double(6)}(1); else w=varargin{i_double(6)}; end
% if ~isempty(varargin{i_double(7)}), wstep=varargin{i_double(7)}(1); else wstep=1; end if ~isempty(varargin{i_double(7)}), lmin=varargin{i_double(7)}(1); else lmin=lmin_default; end
end end
else else
error('No valid arguments.') error('No valid arguments.')
...@@ -291,8 +296,21 @@ for j=-w:w, clear z z0 z1 ...@@ -291,8 +296,21 @@ for j=-w:w, clear z z0 z1
if sum(x4(:,N(2)+1+j))==N(2), l1=N(2);else if sum(x4(:,N(2)+1+j))==N(2), l1=N(2);else
z=diff(x4(:,N(2)+1+j)); z=diff(x4(:,N(2)+1+j));
if ~isempty(find(~(z-1))),z0(:,1)=find(~(z-1));else,z0(1:N(2))=0;end, if ~isempty(find(~(z-1))) & any(~(z-1))
if ~isempty(find(~(z+1))),z1=find(~(z+1));else,z1(1:N(2))=0;end z0(:,1)=find(~(z-1));
else
z0(1:N(2))=0;
end
if ~isempty(find(~(z+1))) & any(~(z+1))
z1=find(~(z+1));
else
z1(1:N(2))=0;
end
% some brutforce corrections
adjustlength = min(length(z0), length(z1));
z0 = z0(1:adjustlength);
z1 = z1(1:adjustlength);
if z0(1)>z1(1) if z0(1)>z1(1)
z0(2:end+1,1)=z0(1:end);z0(1)=0; z0(2:end+1,1)=z0(1:end);z0(1)=0;
......
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