Re: Average and Variance of a periodic angles



On Fri, 07 Mar 2008 13:01:12 -0800, jstout wrote:

I'm trying to compute the average of an array of angles, and the
variance of that array. The problem is the data in an array of angles
and the data is periodic in 2.0 pi radians.

<snip>
One way is to use the iterative formulae for mean and variance
but with all subtractions/additions of angles replaced with
subtractions/additions mod 2pi. Given angles a[0 .. n-1]
double f;
double mean = a[0];
double var = 0.0;
for i=1; i<n; ++n)
{ f = 1.0/(i+1);
da = remainder( a[i]-mean, 2.0*pi); /* da = a[i]-mean; */
mean = remainder( mean+f*da, 2.0*pi); /* mean += f*da; */
var = (1.0-f)*(var + f*da*da);
}


Of course it's not always clear what the mean angle is -
whats the mean of 0 and pi ? The above will give pi/2; the
method of converting to unit vectors could end in atan2(0,0)
which is not so cool...
.



Relevant Pages

  • Average and Variance of a periodic angles
    ... I'm trying to compute the average of an array of angles, ... avg = atan2(avgy, avgx); ... Now my problem comes in when trying to calculate the variance. ...
    (sci.math.num-analysis)
  • Re: Data in table, may need to convert to columns with OFFSET?
    ... I should have known that array formulae were ... I used that to then create a pivot table from my data to find max, min, ... Biff Wrote: ... A2:A7 for the angles and B1:F1 for the energies. ...
    (microsoft.public.excel.misc)
  • Re: mean ans std dev of an array?
    ... Do I need to import it into a Numeric Array to do this? ... If you build an air liner or a ocean liner with this and the wings fall off at thirty thousand feet or it turns upside down in the middle of an ocean, respectively of course, I expect a bunch of contingency lawers lining up at my door wanting to sue you on my behalf.) ... Takes a sequence and returns mean, variance and standard deviation. ...
    (comp.lang.python)
  • Re: Presence of logical ones around a pixel in a certain direction and distance
    ... relative indices and access the array at those locations" ... That would be true for the angles as well, ...
    (comp.soft-sys.matlab)
  • Re: averaging based on multiple criteria
    ... #1 as an array ... this spreadsheet is populated with new data weekly where there is ... a variance between how many rows will contain data, ... > What are the exact formulas you have used ...
    (microsoft.public.excel)