Home > atmlab > circular > circ_dist2.m

circ_dist2

PURPOSE ^

SYNOPSIS ^

function r = circ_dist2(x,y)

DESCRIPTION ^

 r = circ_dist(alpha, beta)
   All pairwise difference x_i-y_j around the circle computed efficiently.

   Input:
     alpha       sample of linear random variable
     beta       sample of linear random variable

   Output:
     r       matrix with pairwise differences

 References:
     Biostatistical Analysis, J. H. Zar, p. 651

 PHB 3/19/2009

 Circular Statistics Toolbox for Matlab

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

circ_dist2.m

SOURCE CODE ^

0001 function r =  circ_dist2(x,y)
0002 %
0003 % r = circ_dist(alpha, beta)
0004 %   All pairwise difference x_i-y_j around the circle computed efficiently.
0005 %
0006 %   Input:
0007 %     alpha       sample of linear random variable
0008 %     beta       sample of linear random variable
0009 %
0010 %   Output:
0011 %     r       matrix with pairwise differences
0012 %
0013 % References:
0014 %     Biostatistical Analysis, J. H. Zar, p. 651
0015 %
0016 % PHB 3/19/2009
0017 %
0018 % Circular Statistics Toolbox for Matlab
0019 
0020 % By Philipp Berens, 2009
0021 % berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens/circStat.html
0022 
0023 if nargin < 2
0024   y = x;
0025 end
0026 
0027 if size(x,2)>size(x,1)
0028   x = x';
0029 end
0030 
0031 if size(y,2)>size(y,1)
0032   y = y';
0033 end
0034 
0035 r = angle(repmat(exp(1i*x),1,length(y)) ...
0036        ./ repmat(exp(1i*y'),length(x),1));

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005