角度的加权平均值
我想计算一组角度的加权平均值。
现在我想弄清楚如何计算加权平均值。 即每个角度都有一个权重(权重总和为1)
0.25,0度 0.5、20度 0.25, 90 度
加权平均值(如果我没有犯错的话)应该是 32 度。
I want to calculate the weighted mean of a set of angles.
In this Question, there's an answer how to calculate the mean
as shown in this page.
Now I'm trying to figure out how to calculate the weighted average.
That is, for each angle there is a weight (the weights sum up to 1)
0.25, 0 degrees
0.5, 20 degrees
0.25, 90 degrees
The weighted avg should (if I didn't make a mistake) be 32 degrees.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我的尝试是将这些值与权重相乘:
似乎工作正常。我必须考虑好的测试数据。
OK, my attemp was to just multiply the values with the weights:
It SEEMS to work correct. I have to think of good test data.
根据您的应用,该问题有不同的答案。如上所述,您可能需要标准化您的值,并且您可能需要有符号角度,或者您可能不希望这样做。除非您知道角度生成函数是什么,否则可能没有唯一的答案。
这对我(从事几何工作)来说是一个足够的问题,我编写了自己的角度类。
Depending on your application the question has different answers. As mentioned above you may need to normalize your values and you may need to have signed angles, or you may not wish to. Unless you know what the angle generating function is there may not be a unique answer.
This was a sufficient problem for me (working in geometry) I wrote my own Angle class.