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

some comments added

parent a6aa96ea
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ function varargout=hist2(varargin) ...@@ -25,7 +25,7 @@ function varargout=hist2(varargin)
% %
% See also HIST, HISTN, BAR3, MI. % See also HIST, HISTN, BAR3, MI.
% Copyright (c) 2002-2003 % Copyright (c) 2002-2007
% Andre Sitz, Norbert Marwan, Potsdam University, Germany % Andre Sitz, Norbert Marwan, Potsdam University, Germany
% http://www.agnld.uni-potsdam.de % http://www.agnld.uni-potsdam.de
% %
...@@ -33,6 +33,9 @@ function varargout=hist2(varargin) ...@@ -33,6 +33,9 @@ function varargout=hist2(varargin)
% $Revision$ % $Revision$
% %
% $Log$ % $Log$
% Revision 1.10 2006/07/04 14:05:08 marwan
% lag = zero allowed
%
% Revision 1.9 2004/11/10 07:05:37 marwan % Revision 1.9 2004/11/10 07:05:37 marwan
% initial import % initial import
% %
...@@ -82,15 +85,21 @@ if size(x,1)<size(x,2), x=x';end ...@@ -82,15 +85,21 @@ if size(x,1)<size(x,2), x=x';end
if size(y,1)<size(y,2), y=y';end if size(y,1)<size(y,2), y=y';end
x=x(:,1); y=y(:,1); x=x(:,1); y=y(:,1);
%x=x(:); y=y(:); %x=x(:); y=y(:);
x1=(x-min(x))/max(x-min(x))-eps;
y1=(y-min(y))/max(y-min(y))-eps; % normalise the value range to [0 1)
x1 = (x - min(x)) / max(x - min(x)) - eps;
y1 = (y - min(y)) / max(y - min(y)) - eps;
if length(x)<=lag, lag=length(x)-1; warning(['Lag is too large. Using ',num2str(lag),' instead.']), end if length(x)<=lag, lag=length(x)-1; warning(['Lag is too large. Using ',num2str(lag),' instead.']), end
temp=fix(x1(1:(end-lag))*nbin)+(fix(y1((lag+1):end)*nbin))*nbin; % this is the main trick: put the first data to values [1:1:nbin] and the second data to [nbin:nbin:nbin^2]
temp = fix(x1(1:(end-lag)) * nbin) + (fix(y1((lag+1):end) * nbin)) * nbin;
% call Matlab histc function (faster than hist)
p=histc(temp,0:(nbin^2-1))'; p=histc(temp,0:(nbin^2-1))';
p2=reshape(p,nbin,nbin)/length(x); p2=reshape(p,nbin,nbin)/length(x);
% create the correct bin denominator
minx = min(min(x)); maxx = max(max(x)); minx = min(min(x)); maxx = max(max(x));
if minx == maxx, minx = minx - floor(nbin/2) - 0.5; maxx = maxx + ceil(nbin/2) - 0.5; end if minx == maxx, minx = minx - floor(nbin/2) - 0.5; maxx = maxx + ceil(nbin/2) - 0.5; end
miny = min(min(y)); maxy = max(max(y)); miny = min(min(y)); maxy = max(max(y));
......
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