Hallo altogether.
I've got a little problem, which might sound a little bit stupid.
How do I correctly average angles, keeping the periodicity in mind?
The only (more or less) correct way I found is derived from averaging
complex numbers, using the transformation from polar to cartesian
coordinates:
<ang>=arctan(<sin(ang_i)>/<cos(ang_i)>)
(in Fortran: atan2(<sin(ang_i)>,<cos(ang_i)>))
But, since it's derived from vector averaging, it has quite a strange
behavior for averaging:
0, 0, 180, 180 => -90
0, 0, 180, 180, 180 => 180
0, 0, 0, 180, 180 => 0
or in more detail (with n>=1):
n*0, n*180 => -90
n*0, (n+1)*180 => 180
(n+1)*0, n*180 => 0
Hence, if the total number of values is odd and the difference between
the values is 180, nearly half of all values would be neglected. That's
my problem.
Has somebody a better soulution for this problem?
Any hints are welcome.
Bye,
Rainer Gratias.
********************************************************************************
Technische Universitaet Muenchen
Institut fuer Organische Chemie und Biochemie
Lehrstuhl fuer Organische Chemie II
Rainer Gratias
Lichtenbergstr. 4
D-85747 Garching
Tel : ++49 +89 289-13324
FAX : ++49 +89 289-13210
e-mail: rg at artus.org.chemie.tu-muenchen.de
********************************************************************************