circvar.m 309 B

123456789101112131415
  1. function cvar=circvar(ph)
  2. % Synopsis
  3. % cm=circvar(ph)
  4. % Desription:
  5. % cm is the circular variance of the phase data in
  6. % ph (angular data) in radians
  7. C=sum(cos(ph), 'omitnan');
  8. S=sum(sin(ph), 'omitnan');
  9. R=sqrt(S^2+C^2);
  10. l=find(not(isnan(ph)));
  11. if(length(l)>0);
  12. cvar=1-R/length(l);
  13. else
  14. cvar=NaN;
  15. end;