circ_vmpar.m 907 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. function [thetahat kappa] = circ_vmpar(alpha,w,d)
  2. % r = circ_vmpar(alpha, w, d)
  3. % Estimate the parameters of a von Mises distribution.
  4. %
  5. % Input:
  6. % alpha sample of angles in radians
  7. % [w number of incidences in case of binned angle data]
  8. % [d spacing of bin centers for binned data, if supplied
  9. % correction factor is used to correct for bias in
  10. % estimation of r, in radians (!)]
  11. %
  12. % Output:
  13. % thetahat preferred direction
  14. % kappa concentration parameter
  15. %
  16. % PHB 3/23/2009
  17. %
  18. % References:
  19. % Statistical analysis of circular data, N.I. Fisher
  20. %
  21. % Circular Statistics Toolbox for Matlab
  22. % By Philipp Berens, 2009
  23. % berens@tuebingen.mpg.de
  24. alpha = alpha(:);
  25. if nargin < 2
  26. w = ones(size(alpha));
  27. end
  28. if nargin < 3
  29. d = 0;
  30. end
  31. r = circ_r(alpha,w,d);
  32. kappa = circ_kappa(r);
  33. thetahat = circ_mean(alpha,w);