Re: Average and Variance of a periodic angles
- From: Duncan Muirhead <noone@xxxxxxxxxxxx>
- Date: Tue, 11 Mar 2008 10:22:06 +0000
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<snip>
variance of that array. The problem is the data in an array of angles
and the data is periodic in 2.0 pi radians.
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...
.
- References:
- Average and Variance of a periodic angles
- From: jstout
- Average and Variance of a periodic angles
- Prev by Date: Re: Heatconduction - numerical analysis
- Next by Date: Re: Help with least square fit to normal distribution
- Previous by thread: Re: Average and Variance of a periodic angles
- Next by thread: SOURCES OF ISLAM
- Index(es):
Relevant Pages
|