# C[omp]ute

Welcome to my blog, which was once a mailing list of the same name and is still generated by mail. Please reply via the "comment" links.

Always interested in offers/projects/new ideas. Eclectic experience in fields like: numerical computing; Python web; Java enterprise; functional languages; GPGPU; SQL databases; etc. Based in Santiago, Chile; telecommute worldwide. CV; email.

© 2006-2015 Andrew Cooke (site) / post authors (content).

## 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