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

bug fix in interdependent neighbours method

parent 18e043f4
No related branches found
Tags v5.3
No related merge requests found
......@@ -79,6 +79,9 @@ function xout=crp(varargin)
% $Revision$
%
% $Log$
% Revision 5.3 2005/06/15 15:16:00 marwan
% RP matrix transposed for "interdependent neighbourhood"
%
% Revision 5.2 2005/04/15 09:02:32 marwan
% minor bugfix in plugin section
%
......@@ -688,15 +691,19 @@ switch(action)
if check_stop(hCRP,hCtrl,nogui,obj), return, end
[SSy, JJy]=sort(sy);%SSy(1,:)=[]; JJy(1,:)=[];
if check_stop(hCRP,hCtrl,nogui,obj), return, end
e=mean(SSy(mine:mine+1,:));
ey=mean(SSy(mine:mine+1,:));
ex=mean(SSx(mine:mine+1,:));
set(findobj('Tag','Status','Parent',findobj('Parent',hCRP,'Tag','CRPPlot')),'String','Building CRP Matrix'),drawnow
for i=1:min(NX,NY),
if check_stop(hCRP,hCtrl,nogui,obj), return, end
JJx((JJx(1:mine,i)>min(NX,NY)),i)=1;
X(i,JJx(1:mine,i)) = (sy(i,JJx(1:mine,i))<=e(i))';
JJx((JJx(1:mine,i)>min(NX,NY)),i)=i;
JJy((JJy(1:mine,i)>min(NX,NY)),i)=i;
X(i,JJx(1:mine,i)) = (sy(i,JJx(1:mine,i))<=ey(i))';
if check_stop(hCRP,hCtrl,nogui,obj), return, end
X(i,JJy(1:mine,i)) = (sx(i,JJy(1:mine,i))<=ex(i))';
end
clear X1 SS* JJ* s sx sy s1 px py
clear X1 SS* JJ* s sx sy s1 px py ex ey
matext=[num2str(round(1000*mine/NY)/10) '% (interdependent neighbours)'];
......
......@@ -63,7 +63,7 @@ function xout=crp2(varargin)
% plot(a,b,'.')
% crp2(a(1:500),b(1:500),'nonorm','euclidean')
%
% b = sin(.01 * ([1:1000] * 2 * pi/67) . ^2);
% b = sin(.01 * ([1:1000] * 2 * pi/67) .^2);
% crp2(b(1:500),a(1:700),3,10,.06,'fan')
%
% See also CRP, CRP_BIG, JRP and TRACKPLOT.
......@@ -73,7 +73,7 @@ function xout=crp2(varargin)
% Cross Recurrence Plot Based Synchronization of Time Series,
% Nonlin. Proc. Geophys., 9, 2002.
% Copyright (c) 1998-2004 by AMRON
% Copyright (c) 1998-2005 by AMRON
% Norbert Marwan, Potsdam University, Germany
% http://www.agnld.uni-potsdam.de
%
......@@ -81,6 +81,9 @@ function xout=crp2(varargin)
% $Revision$
%
% $Log$
% Revision 5.3 2005/09/02 08:02:57 marwan
% line fitting algorithm improved (linear interpolation between set points)
%
% Revision 5.2 2005/04/15 09:02:32 marwan
% minor bugfix in plugin section
%
......@@ -518,7 +521,7 @@ switch(action)
'Units','Normalized',...
'HorizontalAlignment','center',...
'Position',[.15 .65 .7 .06]);
h1=textwrap(h0,{' AGNLD','University of Potsdam','1998-2004'});
h1=textwrap(h0,{' AGNLD','University of Potsdam','1998-2005'});
set(h0,'String',h1)
h1=get(h0,'Extent'); h2=get(h0,'Position'); set(h0,'Position',[h2(1) h2(2) h2(3) h1(4)])
......@@ -1340,26 +1343,28 @@ switch(action)
dw=1;
if v < 1, v = 1; end
if h < 1, h = 1; end
W=X(v:v+dw,h:h+dw);
W(1,1)=0;
if ~isempty(fixp)
if find(h==fixp(:,1))
dv=fixp(find(h==fixp(:,1)),2)-v
dv=fixp(find(h==fixp(:,1)),2)-v;
dh=1;
if dv <= 0
h0 = min(find(t > v+dv))
h0 = min(find(t > v+dv));
if isempty(h0), h0 = h; end
t0 = t(end) + dv;
fixold = find(h==fixp(:,1));
if ~isempty(fixold) & fixold > 1; fixold = fixp(fixold - 1,1); else fixold = 0; end
fixold
h1 = max([h0-min([Dmax1,Dmax2]);1;fixold])
h2 = max([h0;1;fixold])
h1 = max([h0-min([Dmax1,Dmax2]);1;fixold]);
h2 = max([h0;1;fixold]);
% h1 = max([h-2*(h-h0);1])
if length(t) > h1 & length(t) > h2
t1 = t(h1);
t2 = t(h2)
t2 = t(h2);
p = polyfit([h1 h2 h],[t1 t2 t0],1);
t(h1:h) = polyval(p,h1:h);
% t(h1:h) = spline([h1 h2 h],[t1 t2 t0],h1:h);
......
......@@ -77,6 +77,9 @@ function xout=crp_big(varargin)
% $Revision$
%
% $Log$
% Revision 5.3 2005/06/15 15:16:00 marwan
% RP matrix transposed for "interdependent neighbourhood"
%
% Revision 5.2 2005/04/15 09:02:32 marwan
% minor bugfix in plugin section
%
......@@ -724,18 +727,21 @@ switch(action)
mine=round(min(NX,NY)*e);
[SSx, JJx]=sort(sx); %SSx(1,:)=[]; JJx(1,:)=[];
[SSy, JJy]=sort(sy); %SSy(1,:)=[]; JJy(1,:)=[];
ee=mean(SSy(mine:mine+1,:));
eey=mean(SSy(mine:mine+1,:));
eex=mean(SSx(mine:mine+1,:));
X0=uint8(zeros(NY,NX));
for ii=1:min(NX,NY),
JJx((JJx(1:mine,ii)>min(NX,NY)),ii)=1;
X0(ii,JJx(1:mine,ii)) = sy(ii,JJx(1:mine,ii))<=ee(ii);
JJx((JJx(1:mine,ii)>min(NX,NY)),ii)=i;
X0(ii,JJx(1:mine,ii)) = sy(ii,JJx(1:mine,ii))<=eey(ii);
JJy((JJy(1:mine,ii)>min(NX,NY)),ii)=i;
X0(ii,JJy(1:mine,ii)) = sx(ii,JJy(1:mine,ii))<=eex(ii);
end
X(1+Ny2*(j-1):Ny2+Ny2*(j-1),1+Nx2*(i-1):Nx2+Nx2*(i-1))=X0';
X(NY0+1:end,:)=[];
X(:,NX0+1:end)=[];
NX=NX0; NY=NY0;
clear X1 SS* JJ* s sx sy s1 px py
clear X1 SS* JJ* s sx sy s1 px py eex eey
matext=[num2str(round(1000*e)/10) '% (interdependent neighbours)'];
......
No preview for this file type
......@@ -33,7 +33,7 @@ function [tout, Nout] = trackplot(varargin)
% Marwan, N., Thiel, M., Nowaczyk, N.: Cross Recurrence Plot Based
% Synchronization of Time Series, Nonlin. Proc. Geophys., 2001.
% Copyright (c) 1998-2004 by AMRON
% Copyright (c) 1998-2005 by AMRON
% Norbert Marwan, Falko Zetsche, Potsdam University, Germany
% http://www.agnld.uni-potsdam.de
%
......@@ -41,6 +41,9 @@ function [tout, Nout] = trackplot(varargin)
% $Revision$
%
% $Log$
% Revision 4.9 2005/09/02 08:02:57 marwan
% line fitting algorithm improved (linear interpolation between set points)
%
% Revision 4.8 2005/03/16 11:19:02 marwan
% help text modified
%
......@@ -663,27 +666,29 @@ case 'start_gui'
end
dw=1;
if v < 1, v = 1; end
if h < 1, h = 1; end
W=X(v:v+dw,h:h+dw);
W(1,1)=0;
if ~isempty(fixp)
if find(h==fixp(:,1))
dv=fixp(find(h==fixp(:,1)),2)-v
dv=fixp(find(h==fixp(:,1)),2)-v;
dh=1;
if dv <= 0
h0 = min(find(t > v+dv))
h0 = min(find(t > v+dv));
if isempty(h0), h0 = h; end
t0 = t(end) + dv;
fixold = find(h==fixp(:,1));
if ~isempty(fixold) & fixold > 1; fixold = fixp(fixold - 1,1); else fixold = 0; end
fixold
h1 = max([h0-min([Dmax1,Dmax2]);1;fixold])
h2 = max([h0;1;fixold])
h1 = max([h0-min([Dmax1,Dmax2]);1;fixold]);
h2 = max([h0;1;fixold]);
% h1 = max([h-2*(h-h0);1])
if length(t) > h1 & length(t) > h2
t1 = t(h1);
t2 = t(h2)
t2 = t(h2);
p = polyfit([h1 h2 h],[t1 t2 t0],1);
t(h1:h) = polyval(p,h1:h);
% t(h1:h) = spline([h1 h2 h],[t1 t2 t0],h1:h);
......@@ -787,7 +792,6 @@ case 'start_gui'
end
end % flagpoint end
if flagpoint, dv, v, end
flagpoint=0;
% output
......
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