Home > FMAToolbox > General > CircularMean.m

CircularMean

PURPOSE ^

CircularMean - Estimate the circular mean.

SYNOPSIS ^

function [m,r] = CircularMean(angles,dim)

DESCRIPTION ^

CircularMean - Estimate the circular mean.

  USAGE

    [m,r] = CircularMean(angles,dim)

    angles         angles in radians
    dim            optional dimension along which the mean should be computed

  OUTPUT

    m              mean angle
    r              resultant length

  SEE

    See also CircularVariance, CircularConfidenceIntervals, Concentration,
    ConcentrationTest.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [m,r] = CircularMean(angles,dim)
0002 
0003 %CircularMean - Estimate the circular mean.
0004 %
0005 %  USAGE
0006 %
0007 %    [m,r] = CircularMean(angles,dim)
0008 %
0009 %    angles         angles in radians
0010 %    dim            optional dimension along which the mean should be computed
0011 %
0012 %  OUTPUT
0013 %
0014 %    m              mean angle
0015 %    r              resultant length
0016 %
0017 %  SEE
0018 %
0019 %    See also CircularVariance, 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 isempty(angles), m = []; return; end
0030 
0031 if nargin < 2,
0032     dim = 1;
0033 end
0034 
0035 isradians(angles);
0036 
0037 angles = exp(i*angles);
0038 r = abs(nanmean(angles,dim));
0039 m = angle(nanmean(angles,dim));

Generated on Fri 16-Mar-2018 13:00:20 by m2html © 2005