## Average Angle

From: andrew cooke <andrew@...>

Date: Fri, 21 Oct 2011 20:34:05 -0300

I need to calculate the average of some noisy angles (phase from FFT).  This
is quite hard to do, once you start to think about it (as a simple example,
consider the average of 0 and 359 degrees).

Anyway, talking with Paulina over dinner, she came up with the idea of taking
the average in cartesian space and then converting back!  So the average angle
is something like atan2(avg(cos), avg(sin)).

This is very cute.  You can even look at the errors in the cos and sin and
decide whether the angle is so poorly defined that it's simply not known...

Andrew