CircularVariance - Estimate circular variance and standard deviation. USAGE [v,s] = CircularVariance(angles,dim) angles angles in radians dim optional dimension along which the mean should be computed OUTPUT v variance s standard deviation SEE See also CircularMean, CircularConfidenceIntervals, Concentration, ConcentrationTest.
0001 function [v,s] = CircularVariance(angles,dim) 0002 0003 %CircularVariance - Estimate circular variance and standard deviation. 0004 % 0005 % USAGE 0006 % 0007 % [v,s] = CircularVariance(angles,dim) 0008 % 0009 % angles angles in radians 0010 % dim optional dimension along which the mean should be computed 0011 % 0012 % OUTPUT 0013 % 0014 % v variance 0015 % s standard deviation 0016 % 0017 % SEE 0018 % 0019 % See also CircularMean, CircularConfidenceIntervals, Concentration, 0020 % ConcentrationTest. 0021 0022 % Copyright (C) 2004-2011 by Michaƫl Zugaro 0023 % 0024 % This program is free software; you can redistribute it and/or modify 0025 % it under the terms of the GNU General Public License as published by 0026 % the Free Software Foundation; either version 3 of the License, or 0027 % (at your option) any later version. 0028 0029 if nargin < 2, 0030 dim = 1; 0031 end 0032 0033 isradians(angles); 0034 0035 angles = exp(i*angles); 0036 r_bar = abs(mean(angles,dim)); 0037 v = 1 - r_bar; 0038 s = sqrt(-2*log(r_bar));