Home > atmlab > circular > circ_std.m

circ_std

PURPOSE ^

s = circ_std(alpha, w, d, dim)

SYNOPSIS ^

function [s s0] = circ_std(alpha, w, d, dim)

DESCRIPTION ^

 s = circ_std(alpha, w, d, dim)
   Computes circular standard deviation for circular data 
   (equ. 26.20, Zar).   

   Input:
     alpha    sample of angles in radians
     [w        weightings in case of binned angle data]
     [d    spacing of bin centers for binned data, if supplied 
           correction factor is used to correct for bias in 
           estimation of r]
     [dim  compute along this dimension, default is 1]

     If dim argument is specified, all other optional arguments can be
     left empty: circ_std(alpha, [], [], dim)

   Output:
     s     angular deviation
     s0    circular standard deviation

 PHB 6/7/2008

 References:
   Biostatistical Analysis, J. H. Zar

 Circular Statistics Toolbox for Matlab

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

circ_std.m

SOURCE CODE ^

0001 function [s s0] = circ_std(alpha, w, d, dim)
0002 % s = circ_std(alpha, w, d, dim)
0003 %   Computes circular standard deviation for circular data
0004 %   (equ. 26.20, Zar).
0005 %
0006 %   Input:
0007 %     alpha    sample of angles in radians
0008 %     [w        weightings in case of binned angle data]
0009 %     [d    spacing of bin centers for binned data, if supplied
0010 %           correction factor is used to correct for bias in
0011 %           estimation of r]
0012 %     [dim  compute along this dimension, default is 1]
0013 %
0014 %     If dim argument is specified, all other optional arguments can be
0015 %     left empty: circ_std(alpha, [], [], dim)
0016 %
0017 %   Output:
0018 %     s     angular deviation
0019 %     s0    circular standard deviation
0020 %
0021 % PHB 6/7/2008
0022 %
0023 % References:
0024 %   Biostatistical Analysis, J. H. Zar
0025 %
0026 % Circular Statistics Toolbox for Matlab
0027 
0028 % By Philipp Berens, 2009
0029 % berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens/circStat.html
0030 
0031 if nargin < 4
0032   dim = 1;
0033 end
0034 
0035 if nargin < 3 || isempty(d)
0036   % per default do not apply correct for binned data
0037   d = 0;
0038 end
0039 
0040 if nargin < 2 || isempty(w)
0041   % if no specific weighting has been specified
0042   % assume no binning has taken place
0043     w = ones(size(alpha));
0044 else
0045   if size(w,2) ~= size(alpha,2) || size(w,1) ~= size(alpha,1) 
0046     error('Input dimensions do not match');
0047   end 
0048 end
0049 
0050 % compute mean resultant vector length
0051 r = circ_r(alpha,w,d,dim);
0052 
0053 s = sqrt(2*(1-r));      % 26.20
0054 s0 = sqrt(-2*log(r));    % 26.21
0055 
0056 
0057

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