How to find the average value for a set of bearings

Possible duplicate:
How do you calculate the average value of a set of angles?

If I have a set of bearings ranging from 1-360, how can I find the average? Usually, to find the average, they would add everything and divide by the number of elements. The problem here is that doing this in the case of [1, 359], 2 bearings will result in 180, which should actually be 360. Any ideas?

+5
source share
3 answers

Present angles as vectors with norm = 1 and average sum.

x1 = {cos(a),sin(a)}

x2 = {cos(b),sin(b)} 

(x1+x2)/2 = {(cos(a)+cos(b))/2,(sin(a)+sin(b))/2} 

which means that the angle for the average is

atan2((sin(a)+sin(b)) /(cos(a)+cos(b)))  

Just beware of controlling possible overflow when the denominator is close to zero.

enter image description here

+7

, ""... .

- x, , , . :

In[2]:= CircDist[a_, b_] := 180 - Mod[180 + a - b, 360]

In[6]:= Average[bearings_] := 
 x /. NMinimize[
    Sum[CircDist[x, bearings[[i]]]^2, {i, 1, Length[bearings]}], 
    x][[2]]

In[10]:= Average[{1, 359}]

Out[10]= -3.61294*10^-15
+1

, , - , {90, 270}? 0 180? , .. , ?

, , :

  • (.. [1, 359] 2 358 )
  • If you want the desired angle to be in the middle of each of them, take this as your difference and add most of the pair counterclockwise (i.e. 359)
  • Use this as a new bearing, and the next (i.e. the third one in the kit) as another bearing, and repeat until everyone is "average."

From the top of my head, I don’t think it will be fair, it will probably shift it in one direction (that is, it is probably preferable to the later values ​​in your set).

0
source

All Articles