diff --git a/crp.m b/crp.m index ba8bae8faef28fcc1c8facf31a2c77dbe6cdd8a3..37191ba389a2de9de4eb1e2192affd62bb5183d9 100644 --- a/crp.m +++ b/crp.m @@ -38,6 +38,7 @@ function xout=crp(varargin) % minnorm - Minimum norm. % nrmnorm - Euclidean norm between normalized vectors % (all vectors have the length one). +% maxnorm - Maximum norm, fixed recurrence rate. % fan - Fixed amount of nearest neighbours. % inter - Interdependent neighbours. % omatrix - Order matrix. @@ -71,7 +72,7 @@ function xout=crp(varargin) % % See also CRP2, CRP_BIG, JRP, CRQA. -% Copyright (c) 1998-2004 by AMRON +% Copyright (c) 1998-2007 by AMRON % Norbert Marwan, Potsdam University, Germany % http://www.agnld.uni-potsdam.de % @@ -79,6 +80,9 @@ function xout=crp(varargin) % $Revision$ % % $Log$ +% Revision 5.11 2007/05/15 16:01:09 marwan +% new neighbourhood criterion: fixed RR +% % Revision 5.10 2007/03/29 13:17:51 marwan % uint8 of order patterns and order matrix % @@ -160,7 +164,7 @@ set(0,'ShowHidden','On') error(nargchk(1,8,nargin)); if nargout>1, error('Too many output arguments'), end -check_meth={'ma','eu','mi','nr','fa','in','om','op','rr','di'}; % maxnorm, euclidean, nrmnorm, fan, distance +check_meth={'ma','eu','mi','nr','rr','fa','in','om','op','di'}; % maxnorm, euclidean, nrmnorm, fan, distance check_norm={'non','nor'}; % nonormalize, normalize check_gui={'gui','nog','sil'}; % gui, nogui, silent @@ -219,11 +223,11 @@ if isnumeric(varargin{1})==1 % read commandline input t=round(t); m=round(m); mflag=method; if m < 1, m = 1; end if t < 1, t = 1; end - if method==7 & m > 1, + if method==8 & m > 1, m=1; disp('Warning: For order matrix a dimension of one is used.') end - if method==8 & m == 1, + if method==9 & m == 1, m=2; disp(['Warning: For order patterns recurrence plots the dimension must',10,... 'be larger than one. ',... @@ -305,7 +309,7 @@ else % read input from the GUI action=''; end ds = get(findobj('Tag','Dim','Parent',hCtrl),'UserData'); - if mflag==7 | mflag==8 | mflag==length(check_meth) + if mflag==8 | mflag==9 | mflag==length(check_meth) set(findobj('Tag','Size','Parent',hCtrl),'enable','off'); set(findobj('Tag','Sizetext','Parent',hCtrl),'enable','off'); else @@ -314,11 +318,11 @@ else % read input from the GUI end nonorm = get(findobj('Tag','nonorm','Parent',hCtrl),'UserData'); - if mflag==7 & m > 1, + if mflag==8 & m > 1, m=1; ds = 1; disp('Warning: For order matrix a dimension of one is used.') end - if mflag==8 & m == 1, + if mflag==9 & m == 1, m=2; errordlg(['For order patterns recurrence plots the',10,'dimension must be larger than one.'],'Dimension too small') set(findobj('Tag','Dim','Parent',hCtrl),'Value',m) @@ -360,11 +364,11 @@ if nogui>0 tx(2)={'Euclidean norm'}; tx(3)={'minimum norm'}; tx(4)={'Euclidean norm of normalized distance'}; - tx(5)={'fixed amount of nearest neighbours'}; - tx(6)={'interdependent neighbours'}; - tx(7)={'order matrix'}; - tx(8)={'order pattern'}; - tx(9)={'maximum norm fixed RR'}; + tx(5)={'maximum norm fixed RR'}; + tx(6)={'fixed amount of nearest neighbours'}; + tx(7)={'interdependent neighbours'}; + tx(8)={'order matrix'}; + tx(9)={'order pattern'}; tx(10)={'distance plot'}; disp(['use method: ', char(tx(method))]); if nonorm==1, disp('normalize data'); else disp('do not normalize data'); end @@ -553,7 +557,7 @@ switch(action) % check if plugin exist and is executable [plugin_exist, plugin_name, plugin_path] = is_crp_plugin; - if plugin_exist & ( mflag < 4 | mflag == 8 | mflag == 10 ) & length(x) == length(y) & ~ispc % if plugin exist and method is MAX, MIN, EUC ord DIS + if plugin_exist & ( mflag < 4 | mflag == 9 | mflag == 10 ) & length(x) == length(y) & ~ispc % if plugin exist and method is MAX, MIN, EUC ord DIS if nogui == 1, disp('(plugin used)'), end @@ -581,7 +585,7 @@ switch(action) %%%%%%%%%%%%%%%%% local CRP, fixed distance - case {1,2,3,9} + case {1,2,3,5} errcode=111; set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Reshape Embedding Vectors'),drawnow @@ -597,8 +601,9 @@ switch(action) %%%%%%%%%%%%%%%%% maximum norm s = max(abs(s1),[],3); matext=[num2str(round(100*e)/100) unit ' (fixed distance maximum norm)']; - case 9 + case 5 %%%%%%%%%%%%%%%%% maximum norm, fixed RR + errcode=115; s = max(abs(s1),[],3); ss = sort(s(:)); idx = ceil(e * length(ss)); @@ -656,9 +661,9 @@ switch(action) %%%%%%%%%%%%%%%%% local CRP, fixed neigbours amount - case 5 + case 6 - errcode=115; + errcode=116; if e>=1 e=round(e)/100; txt=['The value for fixed neigbours amount has to be smaller '... @@ -702,9 +707,9 @@ switch(action) %%%%%%%%%%%%%%%%% local CRP, interdependent neigbours - case 6 + case 7 - errcode=116; + errcode=117; if e>=1 e=round(e)/100; txt=['The value for fixed neigbours amount has to be smaller '... @@ -758,9 +763,9 @@ switch(action) %%%%%%%%%%%%%%%%% order matrix - case 7 + case 8 - errcode=117; + errcode=118; set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Compute Order Matrix'),drawnow px = permute(x2, [ 1 3 2 ]); @@ -773,9 +778,9 @@ switch(action) %%%%%%%%%%%%%%%%% order pattern recurrence plot - case 8 + case 9 - errcode=118; + errcode=119; set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Compute Order Patterns'),drawnow diff --git a/crp2.m b/crp2.m index 22984cf54abf26c6cc5d5583fb868ecda4c57486..d5d555b495a9c17856f2fa341c5bab5122fcd1ed 100644 --- a/crp2.m +++ b/crp2.m @@ -37,6 +37,7 @@ function xout=crp2(varargin) % minnorm - Minimum norm. % nrmnorm - Euclidean norm between normalized vectors % (all vectors have the length one). +% maxnorm - Maximum norm, fixed recurrence rate. % fan - Fixed amount of nearest neighbours. % omatrix - Order matrix (disabled). % opattern - Order patterns recurrence plot. @@ -73,7 +74,7 @@ function xout=crp2(varargin) % Cross Recurrence Plot Based Synchronization of Time Series, % Nonlin. Proc. Geophys., 9, 2002. -% Copyright (c) 1998-2006 by AMRON +% Copyright (c) 1998-2007 by AMRON % Norbert Marwan, Potsdam University, Germany % http://www.agnld.uni-potsdam.de % @@ -81,6 +82,9 @@ function xout=crp2(varargin) % $Revision$ % % $Log$ +% Revision 5.12 2007/05/15 16:00:38 marwan +% minor change in outfit +% % Revision 5.11 2007/03/29 13:17:51 marwan % uint8 of order patterns and order matrix % @@ -169,7 +173,7 @@ set(0,'ShowHidden','On') error(nargchk(1,9,nargin)); if nargout>1, error('Too many output arguments'), end -check_meth={'ma','eu','mi','nr','fa','in','om','op','di'}; % maxnorm, euclidean, nrmnorm, fan, distance +check_meth={'ma','eu','mi','nr','rr','fa','in','om','op','di'}; % maxnorm, euclidean, nrmnorm, fan, distance check_norm={'non','nor'}; % nonormalize, normalize check_gui={'gui','nog','sil'}; % gui, nogui, silent @@ -229,11 +233,11 @@ if isnumeric(varargin{1}) % read commandline input if size(x,1)==1, x=x'; end, if size(y,1)==1, y=y'; end m=max([size(x,2) size(y,2)]); - if method==7 & (m*m0) > 1, + if method==8 & (m*m0) > 1, m0=1; error(['The neighbourhood criterion ''Oder matrix''',10,'is not implemented - use crp or crp_big instead.']) end - if method==8 & (m*m0) == 1, + if method==9 & (m*m0) == 1, m0=2; disp(['Warning: For order patterns recurrence plots the dimension must',10,... 'be larger than one. ',... @@ -359,7 +363,7 @@ else % read input from the GUI end h_meth = findobj('Tag','Method','Parent',hCtrl); -if mflag==6, mflag=2; +if mflag==7, mflag=2; warndlg(['The neighbourhood criterion ''Interdependent''',10,'is not implemented - use crp or crp_big instead.'],'Neighbourhood'); waitforbuttonpress if ~isempty(h_meth) @@ -367,7 +371,7 @@ if mflag==6, mflag=2; end return end -if mflag==7, mflag=2; +if mflag==8, mflag=2; warndlg(['The neighbourhood criterion ''Oder matrix''',10,'is not implemented - use crp or crp_big instead.'],'Neighbourhood'); waitforbuttonpress if ~isempty(h_meth) @@ -388,15 +392,16 @@ splash_gpl('crp') if nogui>0 hCRP=9999; if nogui~=2 - tx(1)={'Maximum norm'}; + tx(1)={'maximum norm'}; tx(2)={'Euclidean norm'}; - tx(3)={'Minimum norm'}; + tx(3)={'minimum norm'}; tx(4)={'Euclidean norm of normalized distance'}; - tx(5)={'fixed amount of nearest neighbours'}; - tx(6)={'interdependent neighbours'}; - tx(7)={'order matrix'}; - tx(8)={'order pattern'}; - tx(9)={'distance plot'}; + tx(5)={'maximum norm fixed RR'}; + tx(6)={'fixed amount of nearest neighbours'}; + tx(7)={'interdependent neighbours'}; + tx(8)={'order matrix'}; + tx(9)={'order pattern'}; + tx(10)={'distance plot'}; disp(['use method: ', char(tx(method))]); if nonorm==1, disp('normalize data'); else disp('do not normalize data'); end end @@ -411,7 +416,7 @@ end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% switch routines -try +%try switch(action) @@ -490,7 +495,7 @@ switch(action) 'String','Dimension:',... 'Position',[.16 .905 .35 .02]); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h1(3) h1(4)]) - if method==7, set(h0,'Enable','Off'); end + if method==8, set(h0,'Enable','Off'); end h0=uicontrol(props.text,... % Text Dimensionvalue 'Units','Normalized',... @@ -499,7 +504,7 @@ switch(action) 'Position',[.74 .905 .15 .02], ... 'ToolTip','Embedding dimension.'); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h1(3) h1(4)]) - if method==7, set(h0,'Enable','Off'); end + if method==8, set(h0,'Enable','Off'); end h0=uicontrol(props.popup,... % Input Dimensionfactor 'Units','Normalized',... @@ -510,14 +515,14 @@ switch(action) 'Callback','crp2 dimfit',... 'ToolTip','Select the embedding dimensionfactor.'); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) - if method==7, set(h0,'Enable','Off'); end + if method==8, set(h0,'Enable','Off'); end h0=uicontrol(props.text,... % Text Delay 'Units','Normalized',... 'String','Delay:',... 'Position',[.16 .862 .35 .02]); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) - if method==7, set(h0,'Enable','Off'); end + if method==8, set(h0,'Enable','Off'); end h0=uicontrol(props.edit,... % Input Delay 'Units','Normalized',... @@ -529,7 +534,7 @@ switch(action) if m0==1; set(h0,'Enable','off') end - if method==7, set(h0,'Enable','Off'); end + if method==8, set(h0,'Enable','Off'); end h0=uicontrol(props.text,... % Text Vector Excluding 'Units','Normalized',... @@ -558,7 +563,7 @@ switch(action) 'Units','Normalized',... 'HorizontalAlignment','center',... 'Position',[.15 .65 .7 .06]); - h1=textwrap(h0,{[char(169),' AGNLD'],'University of Potsdam','1998-2006'}); + h1=textwrap(h0,{[char(169),' AGNLD'],'University of Potsdam','1998-2007'}); set(h0,'String',h1) h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) @@ -581,8 +586,8 @@ switch(action) 'Tag','Unthresh',... 'ToolTip','Switch between thresholded and unthresholded CRP.' ); - if method==9, set(h0,'Value',1); end - if method==7 | method==8, set(h0,'Enable','Off'); end + if method==10, set(h0,'Value',1); end + if method==8 | method==9, set(h0,'Enable','Off'); end h1=uicontrol(props.popup, ... % Button Unthresholded Scale 'Units','Normalized',... @@ -594,17 +599,17 @@ switch(action) 'Tag','Log',... 'ToolTip','Switch between various scaled CRP.' ); - if method==9, set(h1,'Enable','On'); end + if method==10, set(h1,'Enable','On'); end h2=uicontrol(props.popup,... % Input Neighbourhood Method 'Units','Normalized',... - 'String','Maximum Norm|Euclidean Norm|Minimum Norm|Normalized Norm|Fixed Amount|Interdependent|Order Matrix|Order Pattern',... + 'String','Maximum Norm|Euclidean Norm|Minimum Norm|Normalized Norm|Fixed RR|Fixed Amount|Interdependent|Order Matrix|Order Pattern',... 'Position',[.16 .509 .67 .032],... 'CallBack','crp2 unthresh',... 'Tag','Method',... 'ToolTip','Select the method of finding neighbours.'); - if method==9, set(h2,'Enable','Off'); else, set(h2,'Value',method); end + if method==10, set(h2,'Enable','Off'); else, set(h2,'Value',method); end h0=uicontrol(props.text,... % Text Threshold 'Units','Normalized',... @@ -613,7 +618,7 @@ switch(action) 'Position',[.16 .462 .35 .02]); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) - if method==9 | method==8, set(h0,'Enable','Off'); end + if method==10 | method==9, set(h0,'Enable','Off'); end h0=uicontrol(props.edit,... % Input Threshold @@ -625,7 +630,7 @@ switch(action) 'ToolTip','Insert the size of neighbourhood.' ); h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)]) - if method==9 | method==8, set(h0,'Enable','Off'); end + if method==10 | method==9, set(h0,'Enable','Off'); end dark_factor=.86; h0=uicontrol(props.frame,'BackgroundColor',dark_factor*props.frame.BackgroundColor, ... % Frame LOSsearch @@ -929,7 +934,7 @@ switch(action) % check if plugin exist and is executable [plugin_exist, plugin_name, plugin_path] = is_crp_plugin; - if plugin_exist & ( mflag < 4 | mflag == 8 | mflag == 9 ) & length(x) == length(y) & ~ispc % if plugin exist and method is MAX, MIN, EUC ord DIS + if plugin_exist & ( mflag < 4 | mflag == 9 | mflag == 10 ) & length(x) == length(y) & ~ispc % if plugin exist and method is MAX, MIN, EUC ord DIS if nogui == 1, disp('(plugin used)'), end [X matext] = crp_plugin(x, y, m0, t, e, mflag, hCRP, plugin_path, 0); @@ -972,7 +977,7 @@ switch(action) %%%%%%%%%%%%%%%%% local CRP, fixed distance maximum norm - case {1,2,3} + case {1,2,3,5} errcode=111; set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Compute Distance Matrix'),drawnow @@ -994,6 +999,14 @@ switch(action) s=abs(s1); end matext=[num2str(round(100*e)/100) unit ' (fixed distance maximum norm)']; + case 5 + %%%%%%%%%%%%%%%%% maximum norm, fixed RR + errcode=115; + s = max(abs(s1')); + ss = sort(s(:)); + idx = ceil(e * length(ss)); + e = ss(idx); + matext=[num2str(round(100*e)/100) '\sigma (fixed distance maximum norm, fixed RR)']; case 2 %%%%%%%%%%%%%%%%% euclidean norm errcode=112; @@ -1064,9 +1077,9 @@ switch(action) %%%%%%%%%%%%%%%%% local CRP, fixed neigbours amount - case 5 + case 6 - errcode=115; + errcode=116; if e>=1 e=round(e)/100; txt=['The value for fixed neigbours amount has to be smaller '... @@ -1105,27 +1118,27 @@ switch(action) %%%%%%%%%%%%%%%%% local CRP, interdependent neigbours - case 6 + case 7 - errcode=116; + errcode=117; warning('Method not available!') matext=''; %%%%%%%%%%%%%%%%% order matrix - case 7 + case 8 - errcode=117; + errcode=118; warning('Method not available!') matext=''; %%%%%%%%%%%%%%%%% order pattern recurrence plot - case 8 + case 9 - errcode=118; + errcode=119; set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Compute Order Patterns'),drawnow @@ -1618,8 +1631,8 @@ set(0,'ShowHidden','Off') %%%%%%% error handling -%if 0 -catch +if 0 +%catch try, if nogui==0 for i=1:length(obj.enable), set(obj.children(i),'Enable',obj.enable{i}); end set(h(1),'String','Apply',... diff --git a/crp_big.m b/crp_big.m index 2eea08b2892dbbf106e1331e4a86454e61e41db1..914022cadbb0d60fcca04f86a9405ff73a5922f5 100644 --- a/crp_big.m +++ b/crp_big.m @@ -40,6 +40,7 @@ function xout=crp_big(varargin) % minnorm - Minimum norm. % nrmnorm - Euclidean norm between normalized vectors % (all vectors have the length one). +% maxnorm - Maximum norm, fixed recurrence rate. % fan - Fixed amount of nearest neighbours. % inter - Interdependent neighbours. % omatrix - Order matrix. @@ -69,7 +70,7 @@ function xout=crp_big(varargin) % % See also CRP, CRP2, JRP and CRQA. -% Copyright (c) 1998-2004 by AMRON +% Copyright (c) 1998-2007 by AMRON % Norbert Marwan, Potsdam University, Germany % http://www.agnld.uni-potsdam.de % @@ -77,6 +78,9 @@ function xout=crp_big(varargin) % $Revision$ % % $Log$ +% Revision 5.9 2007/03/29 13:17:51 marwan +% uint8 of order patterns and order matrix +% % Revision 5.8 2006/10/24 14:16:16 marwan % minor change: sigma in title line of RP shown only for normalised data % @@ -151,7 +155,7 @@ set(0,'ShowHidden','On') error(nargchk(1,9,nargin)); if nargout>1, error('Too many output arguments'), end -check_meth={'ma','eu','mi','nr','fa','in','om','op','di'}; % maxnorm, euclidean, nrmnorm, fan, distance +check_meth={'ma','eu','mi','nr','rr','fa','in','om','op','di'}; % maxnorm, euclidean, nrmnorm, fan, distance check_norm={'non','nor'}; % nonormalize, normalize check_gui={'gui','nog','sil'}; % gui, nogui, silent @@ -210,11 +214,11 @@ if isnumeric(varargin{1})==1 % read commandline input t=round(t); m=round(m); mflag=method; if m < 1, m = 1; end if t < 1, t = 1; end - if method==7 & m > 1, + if method==8 & m > 1, m=1; disp('Warning: For order matrix a dimension of one is used.') end - if method==8 & m == 1, + if method==9 & m == 1, m=2; disp(['Warning: For order patterns recurrence plots the dimension must',10,... 'be larger than one. ',... @@ -296,7 +300,7 @@ else % read input from the GUI action=''; end ds = get(findobj('Tag','Dim','Parent',hCtrl),'UserData'); - if mflag==7 | mflag==8 | mflag==length(check_meth) + if mflag==8 | mflag==9 | mflag==length(check_meth) set(findobj('Tag','Size','Parent',hCtrl),'enable','off'); set(findobj('Tag','Sizetext','Parent',hCtrl),'enable','off'); else @@ -305,11 +309,11 @@ else % read input from the GUI end nonorm = get(findobj('Tag','nonorm','Parent',hCtrl),'UserData'); - if mflag==7 & m > 1, + if mflag==8 & m > 1, m=1; ds = 1; disp('Warning: For order matrix a dimension of one is used.') end - if mflag==8 & m == 1, + if mflag==9 & m == 1, m=2; errordlg(['For order patterns recurrence plots the',10,'dimension must be larger than one.'],'Dimension too small') set(findobj('Tag','Dim','Parent',hCtrl),'Value',m) @@ -347,15 +351,16 @@ splash_gpl('crp') if nogui>0 hCRP=9999; if nogui~=2 - tx(1)={'Maximum norm'}; + tx(1)={'maximum norm'}; tx(2)={'Euclidean norm'}; - tx(3)={'Minimum norm'}; + tx(3)={'minimum norm'}; tx(4)={'Euclidean norm of normalized distance'}; - tx(5)={'fixed amount of nearest neighbours'}; - tx(6)={'interdependent neighbours'}; - tx(7)={'order matrix'}; - tx(8)={'order pattern'}; - tx(9)={'distance plot'}; + tx(5)={'maximum norm fixed RR'}; + tx(6)={'fixed amount of nearest neighbours'}; + tx(7)={'interdependent neighbours'}; + tx(8)={'order matrix'}; + tx(9)={'order pattern'}; + tx(10)={'distance plot'}; disp(['use method: ', char(tx(method))]); if nonorm==1, disp('normalize data'); else disp('do not normalize data'); end end @@ -523,7 +528,7 @@ switch(action) % check if plugin exist and is executable [plugin_exist, plugin_name, plugin_path] = is_crp_plugin; - if plugin_exist & ( mflag < 4 | mflag == 8 | mflag == 9 ) & length(x) == length(y) & ~ispc % if plugin exist and method is MAX, MIN, EUC ord DIS + if plugin_exist & ( mflag < 4 | mflag == 9 | mflag == 10 ) & length(x) == length(y) & ~ispc % if plugin exist and method is MAX, MIN, EUC ord DIS if nogui == 1, disp('(plugin used)'), end end @@ -634,7 +639,7 @@ switch(action) %%%%%%%%%%%%%%%%% local CRP, fixed distance - case {1,2,3} + case {1,2,3,5} errcode=111; px = permute(x2, [ 1 3 2 ]); @@ -643,8 +648,16 @@ switch(action) switch mflag case 1 %%%%%%%%%%%%%%%%% maximum norm - s = max(abs(s1),[],3); + s = max(abs(s1),[],3); matext=[num2str(round(100*e)/100) unit ' (fixed distance maximum norm)']; + case 5 + %%%%%%%%%%%%%%%%% maximum norm, fixed RR + errcode=115; + s = max(abs(s1),[],3); + ss = sort(s(:)); + idx = ceil(e * length(ss)); + e = ss(idx); + matext=[num2str(round(100*e)/100) '\sigma (fixed distance maximum norm, fixed RR)']; case 2 %%%%%%%%%%%%%%%%% euclidean norm errcode=112; @@ -695,9 +708,9 @@ switch(action) %%%%%%%%%%%%%%%%% local CRP, fixed neigbours amount - case 5 + case 6 - errcode=115; + errcode=116; if e>=1 e=round(e)/100; txt=['The value for fixed neigbours amount has to be smaller '... @@ -732,9 +745,9 @@ switch(action) %%%%%%%%%%%%%%%%% local CRP, interdependent neigbours - case 6 + case 7 - errcode=116; + errcode=117; if e>=1 e=round(e)/100; txt=['The value for fixed neigbours amount has to be smaller '... @@ -782,9 +795,9 @@ switch(action) %%%%%%%%%%%%%%%%% order matrix - case 7 + case 8 - errcode=117; + errcode=118; set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Compute Order Matrix'),drawnow px = permute(x2, [ 1 3 2 ]); @@ -800,9 +813,9 @@ switch(action) %%%%%%%%%%%%%%%%% order pattern recurrence plot - case 8 + case 9 - errcode=118; + errcode=119; set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Compute Order Patterns Matrix'),drawnow diff --git a/crp_man.pdf b/crp_man.pdf index 5d619f91ed0f40a331e4bf4cb2c818b5242b76d0..50f0368ffed3f7c35145902a0c8e7f8e5c2e026b 100755 Binary files a/crp_man.pdf and b/crp_man.pdf differ diff --git a/crqa.m b/crqa.m index c56592c17d17cc9056e97f86bd7bd47b56d01be3..b584d417d0784ed0f01c6bcb197b150fac0eb9b8 100644 --- a/crqa.m +++ b/crqa.m @@ -54,6 +54,7 @@ function xout=crqa(varargin) % minnorm - Minimum norm. % nrmnorm - Euclidean norm between normalized vectors % (all vectors have the length one). +% maxnorm - Maximum norm, fixed recurrence rate. % fan - Fixed amount of nearest neighbours. % inter - Interdependent neighbours. % omatrix - Order matrix. @@ -127,7 +128,7 @@ function xout=crqa(varargin) % Influence of observational noise on the recurrence quantification % analysis, Physica D, 171(3), 2002. -% Copyright (c) 1998-2006 by AMRON +% Copyright (c) 1998-2007 by AMRON % Norbert Marwan, Potsdam University, Germany % http://www.agnld.uni-potsdam.de % @@ -135,6 +136,9 @@ function xout=crqa(varargin) % $Revision$ % % $Log$ +% Revision 5.31 2007/01/10 12:29:24 marwan +% bug fix: rare bug due to a Matlab bug in MenuBar property for some XWindows systems (and only if matlab is running without java) +% % Revision 5.30 2006/11/27 11:45:40 marwan % bug entropy vertical white lines resolved % @@ -259,7 +263,7 @@ errcode=1; w=[];wstep=0; method='max'; method_n=1; time_scale_flag=1; time_scale_flag_x=1; nogui=0; - check_meth={'ma','eu','mi','nr','fa','in','om','op','di'}; % maxnorm, euclidean, nrmnorm, fan, distance + check_meth={'ma','eu','mi','nr','rr','fa','in','om','op','di'}; % maxnorm, euclidean, nrmnorm, fan, distance check_gui={'gui','nog','sil'}; % gui, nogui, silent check_norm={'non','nor'}; % nonormalize, normalize @@ -280,7 +284,7 @@ errcode=1; h=findobj('Tag','crqa_eps'); e=str2num(get(h(1),'String')); h=findobj('Tag','crqa_method'); - method={'Maximum Norm','Euclidean Norm','Minimum Norm','Normalized Norm','FAN','Interdependent','Order Matrix','Order Pattern','Distance Plot'}; + method={'Maximum Norm','Euclidean Norm','Minimum Norm','Normalized Norm','Maximum Norm, fixed RR','FAN','Interdependent','Order Matrix','Order Pattern','Distance Plot'}; method=method{get(h(1),'Value')}; method_n = get(h(1),'Value'); nonorm=get(h(1),'UserData'); @@ -369,7 +373,7 @@ errcode=1; disp('No valid arguments.') return end - if method==7 & m > 1, + if method==8 & m > 1, m=1; disp('Warning: For order matrix a dimension of one is used.') end @@ -576,7 +580,7 @@ case 'init' 'Tag','text_logo',... 'String','Uni Potsdam',... 'Position',[97+30 24.2143+14.5 22 3.5714]); - h2=textwrap(h,{[char(169),' AGNLD'],'University of Potsdam','1998-2006'}); + h2=textwrap(h,{[char(169),' AGNLD'],'University of Potsdam','1998-2007'}); set(h,'String',h2) @@ -740,7 +744,7 @@ case 'init' 'Tag','crqa_method',... 'UserData',nonorm,... 'Value',method_n,... - 'String','Maximum Norm|Euclidean Norm|Minimum Norm|Normalized Norm|Fixed Amount|Interdependent|Order Matrix|Order Patterns|Distance Plot',... + 'String','Maximum Norm|Euclidean Norm|Minimum Norm|Normalized Norm|Fixed RR|Fixed Amount|Interdependent|Order Matrix|Order Patterns|Distance Plot',... 'Position',[89+30 24.6+.2+2.5 22 1.7]); h=uicontrol(props.text,... @@ -975,6 +979,7 @@ if Nx==w, Nx=w+1; end if nogui~=2, hw=waitbar(0,['0/',num2str(Nx-w)]);set(hw,'Name','Please Wait!');h1=get(hw,'chil');h1=get(h1,'title'); drawnow; end if strcmpi(method,'Order Pattern') method = 'op'; end if strcmpi(method,'Order Matrx') method = 'om'; end +if strcmpi(method,'Maximum Norm, fixed RR') method = 'rr'; end % check if plugin exist and is executable @@ -984,7 +989,6 @@ if nogui == 1 & plugin_exist & ( method_n < 4 | method_n == 8 ) & length(x) == l end errcode=20; - for i=1:wstep:Nx-w; if ~nogui set(0,'ShowHidden','on') @@ -1007,9 +1011,9 @@ for i=1:wstep:Nx-w; do_norm = {'non';'nor'}; - + % if plugin exist and method is MAX, MIN or EUC - if plugin_exist & ( method_n < 4 | method_n == 8 ) & length(x) == length(y) + if plugin_exist & ( method_n < 4 | method_n == 9 ) & length(x) == length(y) errcode=21; warning off @@ -1035,7 +1039,7 @@ for i=1:wstep:Nx-w; save(tmp_ydatafile,'y_tmp','-ascii','-tabs'); % call extern rp programme - m_str = {'MAX', 'EUC', 'MIN', 'NR', 'FAN', 'IN', 'OM', 'OP', 'EUC'}; + m_str = {'MAX', 'EUC', 'MIN', 'NR', 'RR', 'FAN', 'IN', 'OM', 'OP', 'EUC'}; [status ] = system([plugin_path,filesep,plugin_name,' -m ',num2str(m), ... ' -t ',num2str(t), ... @@ -1109,7 +1113,6 @@ for i=1:wstep:Nx-w; X=crp2(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,method,'nonorm','silent'); end % X=crp(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,varargin{i_char},'silent'); - warning off if nogui~=2 & ishandle(h1), set(h1,'str',[num2str(i),'/',num2str(Nx-w)]); waitbar(i/(Nx-w)); drawnow, end @@ -1125,7 +1128,6 @@ for i=1:wstep:Nx-w; else X_theiler=X; end - errcode=26; % compute recurrence times of 1st and 2nd type diff --git a/crqad.m b/crqad.m index 938cfef6e2480bb7883b57be2ef82c670a184a3b..15a60347812772b835fdb9b81fafb0aedc14cbcd 100644 --- a/crqad.m +++ b/crqad.m @@ -32,6 +32,7 @@ function out=crqad(varargin) % minnorm - Minimum norm. % nrmnorm - Euclidean norm between normalized vectors % (all vectors have the length one). +% maxnorm - Maximum norm, fixed recurrence rate. % fan - Fixed amount of nearest neighbours. % inter - Interdependent neighbours. % omatrix - Order matrix. @@ -62,7 +63,7 @@ function out=crqad(varargin) % Nonlinear analysis of bivariate data with cross recurrence plots, % Phys. Lett. A, 302, 2002. -% Copyright (c) 2002-2003 by AMRON +% Copyright (c) 2002-2007 by AMRON % Norbert Marwan, Potsdam University, Germany % http://www.agnld.uni-potsdam.de % @@ -70,6 +71,9 @@ function out=crqad(varargin) % $Revision$ % % $Log$ +% Revision 2.6 2006/10/24 14:16:16 marwan +% minor change: sigma in title line of RP shown only for normalised data +% % Revision 2.5 2006/07/04 14:03:57 marwan % axis-error % @@ -113,7 +117,7 @@ splash_gpl('crp'); if nargin & isnumeric(varargin{1}) % check the text input parameters for method, gui - check_meth={'ma','eu','mi','nr','fa','in','om','op','di'}; % maxnorm, euclidean, nrmnorm, fan, distance + check_meth={'ma','eu','mi','nr','rr','fa','in','om','op','di'}; % maxnorm, euclidean, nrmnorm, fan, distance check_gui={'gui','nog','sil'}; % gui, nogui, silent temp_meth=0; temp_gui=0; diff --git a/fnn.m b/fnn.m index db26c20695861432a37b36dc4aa1e3587d3fe78c..1f32d3a5defbe32911719c43c6ed9181e29868b3 100644 --- a/fnn.m +++ b/fnn.m @@ -48,6 +48,9 @@ function out=fnn(varargin) % $Revision$ % % $Log$ +% Revision 5.1 2006/10/24 14:17:47 marwan +% *** empty log message *** +% % % % This program is part of the new generation XXII series. @@ -84,7 +87,7 @@ delete(findobj('Tag','msgbox')) nogui=0; maxM_init = 10; maxM=maxM_init; % maximal dimension -r_init = 2; +r_init = 10; r=r_init; % r-criterion for neighbours distance s_init = Inf; s=s_init; % size of neighbourhood @@ -233,7 +236,7 @@ case 'init' h=uicontrol(props.text,... 'Tag','text_logo',... 'String','Uni Potsdam',... - 'Position',[97 24.2143 22 3.5714]); + 'Position',[97 24.2143 23 3.5714]); h2=textwrap(h,{[char(169),' AGNLD'],'University of Potsdam','2006'}); set(h,'String',h2) diff --git a/jrp.m b/jrp.m index 49a91f07909717f56c999d1044f174349a501370..1bee37266caade2d82e6c1ca5a0273a8aadc1289 100644 --- a/jrp.m +++ b/jrp.m @@ -40,6 +40,7 @@ function xout=jrp(varargin) % minnorm - Minimum norm. % nrmnorm - Euclidean norm between normalized vectors % (all vectors have the length one). +% maxnorm - Maximum norm, fixed recurrence rate. % fan - Fixed amount of nearest neighbours. % inter - Interdependent neighbours. % omatrix - Order matrix. @@ -72,7 +73,7 @@ function xout=jrp(varargin) % Romano, M., Thiel, M., Kurths, J., von Bloh, W.: % Multivariate Recurrence Plots, Phys. Lett. A , 330, 2004. -% Copyright (c) 2004-2005 by AMRON +% Copyright (c) 2004-2007 by AMRON % Norbert Marwan, Potsdam University, Germany % http://www.agnld.uni-potsdam.de % @@ -80,6 +81,9 @@ function xout=jrp(varargin) % $Revision$ % % $Log$ +% Revision 2.4 2006/10/24 14:16:16 marwan +% minor change: sigma in title line of RP shown only for normalised data +% % Revision 2.3 2005/06/15 15:16:48 marwan % bug due to UINT8 data type resolved % @@ -125,7 +129,7 @@ set(0,'ShowHidden','On') error(nargchk(1,8,nargin)); if nargout>1, error('Too many output arguments'), end -check_meth={'ma','eu','mi','nr','fa','in','om','op','di'}; % maxnorm, euclidean, nrmnorm, fan, distance +check_meth={'ma','eu','mi','nr','rr','fa','in','om','op','di'}; % maxnorm, euclidean, nrmnorm, fan, distance check_norm={'non','nor'}; % nonormalize, normalize check_gui={'gui','nog','sil'}; % gui, nogui, silent @@ -222,10 +226,13 @@ if isnumeric(varargin{1})==1 % read commandline input if nonorm==1, y=(y-mean(y))/std(y); end yscale=(1:length(y))'; end - if method==7 & m > 1, + if method==8 & m > 1, m=1; disp('Warning: For order matrix a dimension of one is used.') end + if method==9 + error('Order patterns JRP are not defined.') + end ds=eye(m); @@ -266,7 +273,7 @@ else % read input from the GUI action=''; end ds = get(findobj('Tag','Dim','Parent',hCtrl),'UserData'); - if mflag==7 | mflag==8 | mflag==length(check_meth) + if mflag==8 | mflag==9 | mflag==length(check_meth) set(findobj('Tag','Size','Parent',hCtrl),'enable','off'); set(findobj('Tag','Sizetext','Parent',hCtrl),'enable','off'); else @@ -275,10 +282,15 @@ else % read input from the GUI end nonorm = get(findobj('Tag','nonorm','Parent',hCtrl),'UserData'); - if mflag==7 & m > 1, + if mflag==8 & m > 1, m=1; ds = 1; disp('Warning: For order matrix a dimension of one is used.') end + if mflag==9 + mflag = 1; method = 1; + set(findobj('Tag','Method','Parent',hCtrl),'Value',method) + errordlg(['Order patterns joint recurrence plots are',10,'not defined. Maximum norm used instead.'],'Not defined') + end Nx=length(x); Ny=length(y); NX=Nx-t*(m-1);NY=Ny-t*(m-1); if (NX<1 | NY<1) & strcmpi(action,'apply'); @@ -316,11 +328,12 @@ if nogui>0 tx(2)={'Euclidean norm'}; tx(3)={'minimum norm'}; tx(4)={'Euclidean norm of normalized distance'}; - tx(5)={'fixed amount of nearest neighbours'}; - tx(6)={'interdependent neighbours'}; - tx(7)={'order matrix'}; - tx(8)={'order pattern'}; - tx(9)={'distance plot'}; + tx(5)={'maximum norm fixed RR'}; + tx(6)={'fixed amount of nearest neighbours'}; + tx(7)={'interdependent neighbours'}; + tx(8)={'order matrix'}; + tx(9)={'order pattern'}; + tx(10)={'distance plot'}; disp(['use method: ', char(tx(method))]); if nonorm==1, disp('normalize data'); else disp('do not normalize data'); end end @@ -511,7 +524,7 @@ switch(action) % check if plugin exist and is executable [plugin_exist, plugin_name, plugin_path] = is_crp_plugin; - if plugin_exist & ( mflag < 4 | mflag == 9 ) & length(x) == length(y) % if plugin exist and method is MAX, MIN, EUC ord DIS + if plugin_exist & ( mflag < 4 | mflag == 9 | mflag == 10 ) & length(x) == length(y) % if plugin exist and method is MAX, MIN, EUC ord DIS if nogui == 1, disp('(plugin used)'), end [X1 matext] = crp_plugin(x2, x2, 1, 1, e, mflag, hCRP, plugin_path, 0); @@ -531,7 +544,7 @@ switch(action) %%%%%%%%%%%%%%%%% local JRP, fixed distance - case {1,2,3} + case {1,2,3,5} errcode=111; @@ -553,18 +566,33 @@ switch(action) switch mflag case 1 %%%%%%%%%%%%%%%%% maximum norm + errcode=115; + e1 = e; e2 = e; sx = max(abs(s1),[],3); sy = max(abs(s2),[],3); matext=[num2str(round(100*e)/100) unit ' (fixed distance maximum norm)']; + case 5 + %%%%%%%%%%%%%%%%% maximum norm, fixed RR + sx = max(abs(s1),[],3); + ss = sort(sx(:)); + idx = ceil(e * length(ss)); + e1 = ss(idx); + sy = max(abs(s2),[],3); + ss = sort(sy(:)); + idx = ceil(e * length(ss)); + e2 = ss(idx); + matext=[num2str(round(100*e)/100) '\sigma (fixed distance maximum norm, fixed RR)']; case 2 %%%%%%%%%%%%%%%%% euclidean norm errcode=112; + e1 = e; e2 = e; sx = sqrt(sum(s1.^2, 3)); sy = sqrt(sum(s2.^2, 3)); matext=[num2str(round(100*e)/100) unit ' (fixed distance euclidean norm)']; case 3 %%%%%%%%%%%%%%%%% minimum norm errcode=113; + e1 = e; e2 = e; sx = sum(abs(s1), 3); sy = sum(abs(s2), 3); matext=[num2str(round(100*e)/100) unit ' (fixed distance minimum norm)']; @@ -572,8 +600,8 @@ switch(action) set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')'),'String','Building JRP Matrix'),drawnow if check_stop(hCRP,hCtrl,nogui,obj), return, end - X1=sx<e; - X2=sy<e; + X1=sx<e1; + X2=sy<e2; if check_stop(hCRP,hCtrl,nogui,obj), return, end X = uint8(X1' .* X2)'; clear s s1 s2 sx sy x1 y1 px py X1 X2 @@ -621,9 +649,9 @@ switch(action) %%%%%%%%%%%%%%%%% local JRP, fixed neigbours amount - case 5 + case 6 - errcode=115; + errcode=116; if e>=1 e=round(e)/100; txt=['The value for fixed neigbours amount has to be smaller '... @@ -688,9 +716,9 @@ switch(action) %%%%%%%%%%%%%%%%% local JRP, interdependent neigbours - case 6 + case 7 - errcode=116; + errcode=117; if e>=1 e=round(e)/100; txt=['The value for fixed neigbours amount has to be smaller '... @@ -773,9 +801,9 @@ switch(action) %%%%%%%%%%%%%%%%% order matrix - case 7 + case 8 - errcode=117; + errcode=118; set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Compute Order Matrix (1)'),drawnow px = permute(x2, [ 1 3 2 ]); @@ -795,9 +823,9 @@ switch(action) %%%%%%%%%%%%%%%%% order pattern recurrence plot - case 8 + case 9 - errcode=118; + errcode=119; set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Compute Order Patterns'),drawnow diff --git a/jrqa.m b/jrqa.m index 7529f4f453628531665620eda8324d05bf7cad90..f57725c9701e0c9191a41f81e5c849b280cb5e4e 100644 --- a/jrqa.m +++ b/jrqa.m @@ -54,6 +54,7 @@ function xout=jrqa(varargin) % minnorm - Minimum norm. % nrmnorm - Euclidean norm between normalized vectors % (all vectors have the length one). +% maxnorm - Maximum norm, fixed recurrence rate. % fan - Fixed amount of nearest neighbours. % inter - Interdependent neighbours. % omatrix - Order matrix. @@ -108,7 +109,7 @@ function xout=jrqa(varargin) % Romano, M., Thiel, M., Kurths, J., von Bloh, W.: % Multivariate Recurrence Plots, Phys. Lett. A , 330, 2004. -% Copyright (c) 1998-2006 by AMRON +% Copyright (c) 1998-2007 by AMRON % Norbert Marwan, Potsdam University, Germany % http://www.agnld.uni-potsdam.de % @@ -116,6 +117,9 @@ function xout=jrqa(varargin) % $Revision$ % % $Log$ +% Revision 2.4 2006/02/14 11:45:49 marwan +% *** empty log message *** +% % Revision 2.3 2005/11/28 10:16:35 marwan % && and || changed to & and | % (seems to cause problems in Matlab 12.1) @@ -165,7 +169,7 @@ splash_gpl('crp'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% check and read the input -try +%try errcode=1; set(0,'ShowHidden','on') @@ -176,7 +180,7 @@ errcode=1; w=[];wstep=0; method='max'; method_n=1; time_scale_flag=1; time_scale_flag_x=1; nogui=0; - check_meth={'ma','eu','mi','nr','fa','in','om','op','di'}; % maxnorm, euclidean, nrmnorm, fan, distance + check_meth={'ma','eu','mi','nr','rr','fa','in','om','op','di'}; % maxnorm, euclidean, nrmnorm, fan, distance check_gui={'gui','nog','sil'}; % gui, nogui, silent check_norm={'non','nor'}; % nonormalize, normalize @@ -197,7 +201,7 @@ errcode=1; h=findobj('Tag','crqa_eps'); e=str2num(get(h(1),'String')); h=findobj('Tag','crqa_method'); - method={'Maximum Norm','Euclidean Norm','Minimum Norm','Normalized Norm','FAN','Interdependent','Order Matrix','Order Pattern','Distance Plot'}; + method={'Maximum Norm','Euclidean Norm','Minimum Norm','Normalized Norm','Maximum Norm, fixed RR','FAN','Interdependent','Order Matrix','Order Pattern','Distance Plot'}; method=method{get(h(1),'Value')}; nonorm=get(h(1),'UserData'); h=findobj('Tag','crqa_lmin'); @@ -465,7 +469,7 @@ case 'init' 'Tag','text_logo',... 'String','Uni Potsdam',... 'Position',[97+30 24.2143+14.5 22 3.5714]); - h2=textwrap(h,{[char(169),' AGNLD'],'University of Potsdam','1998-2006'}); + h2=textwrap(h,{[char(169),' AGNLD'],'University of Potsdam','1998-2007'}); set(h,'String',h2) @@ -629,7 +633,7 @@ case 'init' 'Tag','crqa_method',... 'UserData',nonorm,... 'Value',method_n,... - 'String','Maximum Norm|Euclidean Norm|Minimum Norm|Normalized Norm|Fixed Amount|Interdependent|Order Matrix|Order Patterns|Distance Plot',... + 'String','Maximum Norm|Euclidean Norm|Minimum Norm|Normalized Norm|Fixed RR|Fixed Amount|Interdependent|Order Matrix|Order Patterns|Distance Plot',... 'Position',[89+30 24.6+.2+2.5 22 1.7]); h=uicontrol(props.text,... @@ -860,6 +864,7 @@ if Nx==w, Nx=w+1; end if nogui~=2, hw=waitbar(0,['0/',num2str(Nx-w)]);set(hw,'Name','Please Wait!');h1=get(hw,'chil');h1=get(h1,'title'); drawnow; end if strcmpi(method,'Order Pattern') method = 'op'; end if strcmpi(method,'Order Matrx') method = 'om'; end +if strcmpi(method,'Maximum Norm, fixed RR') method = 'rr'; end % check if plugin exist and is executable @@ -892,6 +897,7 @@ for i=1:wstep:Nx-w; do_norm = {'non';'nor'}; % if plugin exist and method is MAX, MIN or EUC + if plugin_exist & ( method_n < 4 ) & length(x) == length(y) errcode=21; @@ -977,14 +983,14 @@ for i=1:wstep:Nx-w; if length(x(i:i+w-1,:)) > 2000 Xx=crp_big(x(i:i+w-1,:),m,t,e,method,do_norm{nonorm+1},'silent'); Xy=crp_big(y(i:i+w-1,:),m,t,e,method,do_norm{nonorm+1},'silent'); - X = Xx .* Xy; + X = double(Xx) .* double(Xy); else X=jrp(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,method,do_norm{nonorm+1},'silent'); end else Xx=crp2(x(i:i+w-1,:),m,t,e,method,do_norm{nonorm+1},'silent'); Xy=crp2(y(i:i+w-1,:),m,t,e,method,do_norm{nonorm+1},'silent'); - X = Xx .* Xy; + X = double(Xx) .* double(Xy); end % X=crp(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,varargin{i_char},'silent'); @@ -1171,8 +1177,8 @@ end -%if 0 -catch +if 0 +%catch if nogui~=2, if ishandle(hw), close(hw), end , end z=whos;x=lasterr;y=lastwarn;in=varargin{1};