diff --git a/arfit.m b/arfit.m index 5746facf8b93c90e96334211b3f0b913113a089b..5404ed0f6c8c6022c5af8ea6a1627d75e33303d6 100644 --- a/arfit.m +++ b/arfit.m @@ -35,6 +35,10 @@ function varargout=arfit(varargin) % $Revision$ % % $Log$ +% Revision 2.9 2016/03/03 14:57:40 marwan +% updated input/output check (because Mathworks is removing downwards compatibility) +% bug in crqad_big fixed (calculation of xcf). +% % Revision 2.8 2009/03/24 08:30:23 marwan % copyright address changed % @@ -763,7 +767,7 @@ if 0 err=fprintf(fid,'%s\n','description of what you were doing when this problem occurred.'); err=fprintf(fid,'%s\n','E-mail or FAX this information to us at:'); err=fprintf(fid,'%s\n',' E-mail: marwan@pik-potsdam.de'); - err=fprintf(fid,'%s\n',' Fax: ++49 +331 288 2640'); + err=fprintf(fid,'%s\n',' Fax: ++49 +331 288 2508'); err=fprintf(fid,'%s\n\n\n','Thank you for your assistance.'); err=fprintf(fid,'%s\n',repmat('-',50,1)); err=fprintf(fid,'%s\n',datestr(now,0)); @@ -796,7 +800,7 @@ if 0 disp(' this problem occurred.'), disp(' ') disp(' E-mail or FAX this information to us at:') disp(' E-mail: marwan@pik-potsdam.de') - disp(' Fax: ++49 +331 288 2640'), disp(' ') + disp(' Fax: ++49 +331 288 2508'), disp(' ') disp(' Thank you for your assistance.') warning('on') end diff --git a/corrgram.m b/corrgram.m index 1d7d956a0ca5b1cf955b81c37e1282e02be49966..e6bebbc0ec211b35d119f04373a6801c88a152a3 100644 --- a/corrgram.m +++ b/corrgram.m @@ -13,6 +13,9 @@ function [c_out, l_out, t_out] = corrgram(varargin) % k = fix((N-NOVERLAP)/(WINDOW-NOVERLAP)) % columns. % +% C = CORRGRAM(...,METHOD) using either Pearson correlation ('pearson', default), +% Spearman's rank correlation ('spearman'), or Kendall's Tau ('kendall'). +% % [C,L,T] = CORRGRAM(...) returns a column of lag L and one of time T % at which the correlation coefficients are computed. L has length equal % to the number of rows of C, T has length k. @@ -51,7 +54,6 @@ verbose = 1; x = varargin{1}; y = varargin{2}; x = x(:); y = y(:); - % check input and inital setting of parameters nx = length(x); ny = length(y); @@ -67,25 +69,31 @@ maxlag = floor(nx/10); window = floor(nx/10); noverlap = 0; -if length(varargin) > 2 & ~isempty(varargin{3}) +if length(varargin) > 2 & ~isempty(varargin{3}) & isnumeric(varargin{3}) maxlag = varargin{3}; if maxlag < 0, error('Requires positive integer value for maximum lag.'), end if length(maxlag) > 1, error('Requires MAXLAG to be a scalar.'), end end -if length(varargin) > 3 & ~isempty(varargin{4}) +if length(varargin) > 3 & ~isempty(varargin{4}) & isnumeric(varargin{4}) window = varargin{4}; if window < 0, error('Requires positive integer value for window length.'), end if length(window) > 1, error('Requires WINDOW to be a scalar.'), end end -if length(varargin) > 4 & ~isempty(varargin{5}) +if length(varargin) > 4 & ~isempty(varargin{5}) & isnumeric(varargin{5}) noverlap = varargin{5}; if noverlap < 0, error('Requires positive integer value for NOVERLAP.'), end if length(noverlap) > 1, error('Requires NOVERLAP to be a scalar.'), end if noverlap >= window, error('Requires NOVERLAP to be strictly less than the window length.'), end end +% check for input arguments of type char +method = 'Pearson'; +i_char = find(cellfun('isclass',varargin,'char')); +if ~isempty(i_char) + method = varargin{i_char} +end % prepare time delayed signals X = buffer(x,maxlag+1,maxlag)'; @@ -101,21 +109,25 @@ if verbose, h = waitbar(0,'Compute cross correlation'); end % -MAXLAG:0 [Yi dummy] = buffer(Y(:,1),window,noverlap,'nodelay'); -Yi = normalize(Yi); +Yi = zscore(Yi); for i = 1:size(X,2), if verbose, waitbar(cnt/(2*size(X,2))), end [Xi dummy] = buffer(X(:,i),window,noverlap,'nodelay'); - Xi = normalize(Xi); - C(cnt,:) = mean(Xi .* Yi); + Xi = zscore(Xi); + %C(cnt,:) = mean(Xi .* Yi); + C_ = corr(Xi, Yi, 'Type', method); + C(cnt,:) = diag(C_)'; cnt = cnt + 1; end % 0:MAXLAG [Xi dummy] = buffer(X(:,end),window,noverlap,'nodelay'); -Xi = normalize(Xi); +Xi = zscore(Xi); for i = 2:size(Y,2), if verbose, waitbar(cnt/(2*size(X,2))), end [Yi dummy] = buffer(Y(:,i),window,noverlap,'nodelay'); - Yi = normalize(Yi); - C(cnt,:) = mean(Xi .* Yi); + Yi = zscore(Yi); + %C(cnt,:) = mean(Xi .* Yi); + C_ = corr(Xi, Yi, 'Type', method); + C(cnt,:) = diag(C_)'; cnt = cnt + 1; end if verbose, delete(h), end diff --git a/fnn.m b/fnn.m index 8afac481b2ec51b2a6a923d50d5937147dd50d4c..fd644500eb98823e674bf15e7e7b0f834e52b741 100644 --- a/fnn.m +++ b/fnn.m @@ -55,6 +55,10 @@ function out=fnn(varargin) % $Revision$ % % $Log$ +% Revision 5.13 2016/03/03 14:57:40 marwan +% updated input/output check (because Mathworks is removing downwards compatibility) +% bug in crqad_big fixed (calculation of xcf). +% % Revision 5.12 2016/02/05 17:16:37 marwan % fix compatibility issues (R2014b) % @@ -647,7 +651,7 @@ catch err=fprintf(fid,'%s\n','description of what you were doing when this problem occurred.'); err=fprintf(fid,'%s\n','E-mail or FAX this information to us at:'); err=fprintf(fid,'%s\n',' E-mail: marwan@pik-potsdam.de'); - err=fprintf(fid,'%s\n',' Fax: ++49 +331 288 2640'); + err=fprintf(fid,'%s\n',' Fax: ++49 +331 288 2508'); err=fprintf(fid,'%s\n\n\n','Thank you for your assistance.'); err=fprintf(fid,'%s\n',repmat('-',50,1)); err=fprintf(fid,'%s\n',datestr(now,0)); @@ -697,7 +701,7 @@ catch disp(' this problem occurred.'), disp(' ') disp(' E-mail or FAX this information to us at:') disp(' E-mail: marwan@pik-potsdam.de') - disp(' Fax: ++49 +331 288 2640'), disp(' ') + disp(' Fax: ++49 +331 288 2508'), disp(' ') disp(' Thank you for your assistance.') warning('on') end diff --git a/mi.m b/mi.m index 52ab061465177585ce6d497db5f562c5e3b57628..2ff2259c7cc0da4d7705fd9e777f7dfc470fd2ec 100644 --- a/mi.m +++ b/mi.m @@ -60,6 +60,9 @@ function varargout=mi(varargin) % $Revision$ % % $Log$ +% Revision 3.19 2016/04/14 15:15:20 marwan +% adding Hirata's reconstruction method to recons.m +% % Revision 3.18 2016/03/03 14:57:40 marwan % updated input/output check (because Mathworks is removing downwards compatibility) % bug in crqad_big fixed (calculation of xcf). @@ -656,7 +659,7 @@ if 0 fprintf(fid,'%s\n','description of what you were doing when this problem occurred.'); fprintf(fid,'%s\n','E-mail or FAX this information to us at:'); fprintf(fid,'%s\n',' E-mail: marwan@pik-potsdam.de'); - fprintf(fid,'%s\n',' Fax: ++49 +331 288 2640'); + fprintf(fid,'%s\n',' Fax: ++49 +331 288 2508'); fprintf(fid,'%s\n\n\n','Thank you for your assistance.'); fprintf(fid,'%s\n',repmat('-',50,1)); fprintf(fid,'%s\n',datestr(now,0)); @@ -706,7 +709,7 @@ if 0 disp(' this problem occurred.'), disp(' ') disp(' E-mail or FAX this information to us at:') disp(' E-mail: marwan@pik-potsdam.de') - disp(' Fax: ++49 +331 288 2640'), disp(' ') + disp(' Fax: ++49 +331 288 2508'), disp(' ') disp(' Thank you for your assistance.') warning('on') end diff --git a/recons.m b/recons.m index 19012f79e24c2734c25d084cc67dc761673d5b91..15e2f500e2e087be8cfa8f7dc8c9a04e4170a4f3 100644 --- a/recons.m +++ b/recons.m @@ -41,6 +41,9 @@ function varargout=recons(varargin) % $Revision$ % % $Log$ +% Revision 5.6 2016/04/14 15:26:53 marwan +% in recons.m: add test for empty results vector +% % Revision 5.5 2016/04/14 15:15:20 marwan % adding Hirata's reconstruction method to recons.m % @@ -285,7 +288,7 @@ catch err=fprintf(fid,'%s\n','description of what you were doing when this problem occurred.'); err=fprintf(fid,'%s\n','E-mail or FAX this information to us at:'); err=fprintf(fid,'%s\n',' E-mail: marwan@pik-potsdam.de'); - err=fprintf(fid,'%s\n',' Fax: ++49 +331 288 2640'); + err=fprintf(fid,'%s\n',' Fax: ++49 +331 288 2614'); err=fprintf(fid,'%s\n\n\n','Thank you for your assistance.'); err=fprintf(fid,'%s\n',repmat('-',50,1)); err=fprintf(fid,'%s\n',datestr(now,0)); @@ -318,7 +321,7 @@ catch disp(' this problem occurred.'), disp(' ') disp(' E-mail or FAX this information to us at:') disp(' E-mail: marwan@pik-potsdam.de') - disp(' Fax: ++49 +331 288 2640'), disp(' ') + disp(' Fax: ++49 +331 288 2508'), disp(' ') disp(' Thank you for your assistance.') warning('on') end diff --git a/winplot.m b/winplot.m index b99b50eb4e5e538886a0802ab3f80a52475cccf2..2e17b887b6ea82df92e2c7a8845a154dad3e6579 100644 --- a/winplot.m +++ b/winplot.m @@ -36,6 +36,10 @@ function out=winplot(varargin) % $Revision$ % % $Log$ +% Revision 2.8 2016/03/03 14:57:40 marwan +% updated input/output check (because Mathworks is removing downwards compatibility) +% bug in crqad_big fixed (calculation of xcf). +% % Revision 2.7 2014/09/23 07:11:25 marwan % Matlab R2014b incompatibility issues fixed % @@ -511,7 +515,7 @@ catch err=fprintf(fid,'%s\n','description of what you were doing when this problem occurred.'); err=fprintf(fid,'%s\n','E-mail or FAX this information to us at:'); err=fprintf(fid,'%s\n',' E-mail: marwan@pik-potsdam.de'); - err=fprintf(fid,'%s\n',' Fax: ++49 +331 288 2640'); + err=fprintf(fid,'%s\n',' Fax: ++49 +331 288 2508'); err=fprintf(fid,'%s\n\n\n','Thank you for your assistance.'); err=fprintf(fid,'%s\n',repmat('-',50,1)); err=fprintf(fid,'%s\n',datestr(now,0)); @@ -545,7 +549,7 @@ catch disp(' this problem occurred.'), disp(' ') disp(' E-mail or FAX this information to us at:') disp(' E-mail: marwan@pik-potsdam.de') - disp(' Fax: ++49 +331 288 2640'), disp(' ') + disp(' Fax: ++49 +331 288 2508'), disp(' ') disp(' Thank you for your assistance.') warning('on') end