擅长:python、mysql、java
<p>好吧,我的方法是把这些值乘以权重:</p>
<pre><code>def circular_mean(weights, angles):
x = y = 0.
for angle, weight in zip(angles, weights):
x += math.cos(math.radians(angle)) * weight
y += math.sin(math.radians(angle)) * weight
mean = math.degrees(math.atan2(y, x))
return mean
</code></pre>
<p>似乎工作正常。我得考虑好的测试数据。在</p>