Home > atmlab > circular > circ_dist.m

circ_dist

PURPOSE ^

SYNOPSIS ^

function r = circ_dist(x,y)

DESCRIPTION ^

 r = circ_dist(alpha, beta)
   Pairwise difference x_i-y_i around the circle computed efficiently.

   Input:
     alpha      sample of linear random variable
     beta       sample of linear random variable or one single angle

   Output:
     r       matrix with 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_dist.m

SOURCE CODE ^

0001 function r =  circ_dist(x,y)
0002 %
0003 % r = circ_dist(alpha, beta)
0004 %   Pairwise difference x_i-y_i around the circle computed efficiently.
0005 %
0006 %   Input:
0007 %     alpha      sample of linear random variable
0008 %     beta       sample of linear random variable or one single angle
0009 %
0010 %   Output:
0011 %     r       matrix with 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 
0024 if size(x,1)~=size(y,1) && size(x,2)~=size(y,2) && length(y)~=1
0025   error('Input dimensions do not match.')
0026 end
0027 
0028 r = angle(exp(1i*x)./exp(1i*y));

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