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

adding pdist as an alternative to get the RP

parent 24f4f3ae
No related branches found
No related tags found
No related merge requests found
......@@ -147,6 +147,10 @@ function xout=crqa(varargin)
% $Revision$
%
% $Log$
% Revision 5.38 2009/05/14 16:20:32 marwan
% automatic window length determination restored back
% further argument checking (extreme embedding) added
%
% Revision 5.37 2009/03/31 12:28:26 marwan
% automatic window length determination corrected
%
......@@ -271,7 +275,7 @@ yscale = [];
undocumented = 0;
argout_index=[1,2,3,4,5,6,7,8,9,10];
flag_pdist = 0; % use Matlab function PDIST, but only working for single x
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% check the input
error(nargchk(1,13,nargin));
......@@ -1171,17 +1175,29 @@ for i=1:wstep:Nx-w;
errcode=25;
try
% X=crp_big(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,'fan','silent');
if time_scale_flag
if length(x(i:i+w-1,:)) > 2000
X=crp_big(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,method,'nonorm','silent');
else
X=crp(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,method,'nonorm','silent');
end
else
X=crp2(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,method,'nonorm','silent');
end
if ~flag_pdist
if time_scale_flag
if length(x(i:i+w-1,:)) > 2000
X=crp_big(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,method,'nonorm','silent');
else
X=crp(x(i:i+w-1,:),y(i:i+w-1,:),m,t,e,method,'nonorm','silent');
end
else
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');
else
%%%%%%%%%%%%
% alternative using pdist
xcor = @(x,y) sqrt(sum((repmat(x,size(y,1),1)-y).^2,2));
x_dist = pdist(x(i:i+w-1,:),xcor);
X = squareform(x_dist);
end
%%%%%%%%%%%%
warning off
if nogui~=2 & ishandle(h1), set(h1,'str',[num2str(i),'/',num2str(Nx-w)]); waitbar(i/(Nx-w)); drawnow, end
......
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