平均角...再次 [英] Averaging angles... Again
问题描述
我要计算一组角度的平均值,从而重新presents源轴承(0至360度) - (类似风向)
I want to calculate the average of a set of angles, which represents source bearing (0 to 360 deg) - (similar to wind-direction)
我知道它之前(多次)进行了讨论。接受的答案是计算单元从角度向量,并采取他们的平均的角度
I know it has been discussed before (several times). The accepted answer was Compute unit vectors from the angles and take the angle of their average.
不过这个答案定义了平均在非直观的方式。的0,0和90中的平均将是<强>的atan((罪(0)+罪(0)+罪(90))/(COS(0)+ COS(0)+ COS(90)))= ATAN(1/2)= 26.56度
However this answer defines the average in a non intuitive way. The average of 0, 0 and 90 will be atan( (sin(0)+sin(0)+sin(90)) / (cos(0)+cos(0)+cos(90)) ) = atan(1/2)= 26.56 deg
我希望的0,0和90,平均为30度。
I would expect the average of 0, 0 and 90 to be 30 degrees.
所以我觉得要问的问题又是公平的:你会如何计算出平均值,所以这样的例子会给出直观预期的答案
So I think it is fair to ask the question again: How would you calculate the average, so such examples will give the intuitive expected answer.
修改2014年:
问这个问题后,我已经张贴的在$ C $的CProject 的一篇文章,提供了一个全面的分析。本文探讨了以下引用问题:
After asking this question, I've posted an article on CodeProject which offers a thorough analysis. The article examines the following reference problems:
- 在给定时间的日[00:00-24:00)为每生发生在美国在2000年 - 计算的平均出生时的日
- 在给定方向测量从固定发射到固定接收机的多集,使用带有包装的正态分布的误差测量技术 - 估计方向
- 在给定方位估计两个点之间的多集,由普通人(假设为服从一个包裹截断正态分布的误差)制成 - 估计方向
推荐答案
谢谢大家帮我看看我的问题更清楚。
Thank you all for helping me see my problem more clearly.
我找到了我一直在寻找。 这就是所谓的 Mitsuta法
I found what I was looking for. It is called Mitsuta method.
的输入和输出是在范围[0..360)。
The inputs and output are in the range [0..360).
这是一个好方法,用于平均被使用恒定的采样间隔采样数据。
This method is good for averaging data that was sampled using constant sampling intervals.
的方法,假定连续采样之间的差小于180°(这意味着,如果我们将不采样速度不够快,在采样信号一个330度的变化将被错误地检测为一个30度中的其他改变方向,将插入一个错误计算进去)。 采样定理人?
The method assumes that the difference between successive samples is less than 180 degrees (which means that if we won't sample fast enough, a 330 degrees change in the sampled signal would be incorrectly detected as a 30 degrees change in the other direction and will insert an error into the calculation). Nyquist–Shannon sampling theorem anybody ?
下面是一个C ++ code:
Here is a c++ code:
double AngAvrg(const vector<double>& Ang)
{
vector<double>::const_iterator iter= Ang.begin();
double fD = *iter;
double fSigD= *iter;
while (++iter != Ang.end())
{
double fDelta= *iter - fD;
if (fDelta < -180.) fD+= fDelta + 360.;
else if (fDelta > 180.) fD+= fDelta - 360.;
else fD+= fDelta ;
fSigD+= fD;
}
double fAvrg= fSigD / Ang.size();
if (fAvrg >= 360.) return fAvrg -360.;
if (fAvrg < 0. ) return fAvrg +360.;
return fAvrg ;
}
据51页的<一个解释href="http://www.epa.gov/scram001/guidance/met/mmgrma.pdf">http://www.epa.gov/scram001/guidance/met/mmgrma.pdf
感谢您MAR发送的链接注释。
Thank you MaR for sending the link as a comment.
如果采样数据是不变的,但我们的采样装置,具有一个米塞斯分布的不准确,一个单位矢量计算将是适当的。
If the sampled data is constant, but our sampling device has an inaccuracy with a Von Mises distribution, a unit-vectors calculation will be appropriate.
这篇关于平均角...再次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!