Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

circ_std.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. function [s s0] = circ_std(alpha, w, d, dim)
  2. % s = circ_std(alpha, w, d, dim)
  3. % Computes circular standard deviation for circular data
  4. % (equ. 26.20, Zar).
  5. %
  6. % Input:
  7. % alpha sample of angles in radians
  8. % [w weightings in case of binned angle data]
  9. % [d spacing of bin centers for binned data, if supplied
  10. % correction factor is used to correct for bias in
  11. % estimation of r]
  12. % [dim compute along this dimension, default is 1]
  13. %
  14. % If dim argument is specified, all other optional arguments can be
  15. % left empty: circ_std(alpha, [], [], dim)
  16. %
  17. % Output:
  18. % s angular deviation
  19. % s0 circular standard deviation
  20. %
  21. % PHB 6/7/2008
  22. %
  23. % References:
  24. % Biostatistical Analysis, J. H. Zar
  25. %
  26. % Circular Statistics Toolbox for Matlab
  27. % By Philipp Berens, 2009
  28. % berens@tuebingen.mpg.de - www.kyb.mpg.de/~berens/circStat.html
  29. if nargin < 4
  30. dim = 1;
  31. end
  32. if nargin < 3 || isempty(d)
  33. % per default do not apply correct for binned data
  34. d = 0;
  35. end
  36. if nargin < 2 || isempty(w)
  37. % if no specific weighting has been specified
  38. % assume no binning has taken place
  39. w = ones(size(alpha));
  40. else
  41. if size(w,2) ~= size(alpha,2) || size(w,1) ~= size(alpha,1)
  42. error('Input dimensions do not match');
  43. end
  44. end
  45. % compute mean resultant vector length
  46. r = circ_r(alpha,w,d,dim);
  47. s = sqrt(2*(1-r)); % 26.20
  48. s0 = sqrt(-2*log(r)); % 26.21