好的,我的尝试是将值乘以权重:
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
看起来它工作正常。我需要考虑一些好的测试数据。