椭圆的标准形式 [英] Standard form of ellipse

查看:219
本文介绍了椭圆的标准形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到椭圆作为拟合数据集的水平曲线.选择特定的椭圆后,我想将其报告为中心点,半长轴和短轴长度以及旋转角度.换句话说,我想用以下形式转换(使用mathematica)我的椭圆方程:

I'm getting ellipses as level curves of a fit dataset. After selecting a particular ellipse, I would like to report it as a center point, semi-major and minor axes lengths, and a rotation angle. In other words, I would like to transform (using mathematica) my ellipse equation from the form:

Ax^2 + By^2 + Cx + Dy + Exy + F = 0

以更标准的形式:

((xCos[alpha] - ySin[alpha] - h)^2)/(r^2) + ((xSin[alpha] + yCos[alpha] - k)^2)/(s^2) = 1

其中(h,k)是中心,alpha是旋转角度,rs是半轴

where (h,k) is the center, alpha is the rotation angle, and r and s are the semi-axes

我要转换的实际方程是

 1.68052 x - 9.83173 x^2 + 4.89519 y - 1.19133 x y - 9.70891 y^2 + 6.09234 = 0

我知道中心点是拟合的最大值,即:

I know the center point is the fitted maximum, which is:

 {0.0704526, 0.247775}

推荐答案

我在Math SE上发布了此答案的一个版本,因为它得益于适当的数学知识排版.该示例也更简单,并且有一些额外的细节.

I posted a version of this answer on Math SE since it benefits a lot from proper mathematical typesetting. The example there is simpler as well, and there are some extra details.

以下说明遵循德国维基百科文章Hauptachsentransformation .根据wiki间的链接,其英语对应词是主要成分分析.我发现前一篇文章比后一篇文章更具几何意义.不过,后者非常重视统计数据,因此它可能对您还是有用的.

The following description follows the German Wikipedia article Hauptachsentransformation. Its English counterpart, according to inter-wiki links, is principal component analysis. I find the former article a lot more geometric than the latter. The latter has a strong focus on statistical data, though, so it might be useful for you nevertheless.

您的椭圆形被描述为

        [A   E/2]   [x]             [x]
[x y] * [E/2   B] * [y]  +  [C D] * [y] + F = 0

首先,您确定旋转.通过标识此2×2矩阵的特征值和特征向量来执行此操作.这些特征向量将形成一个描述旋转的正交矩阵:其项是公式中的Sin[alpha]Cos[alpha].

First you identify the rotation. You do this by identifying the eigenvalues and eigenvectors of this 2×2 matrix. These eigenvectors will form an orthogonal matrix describing your rotation: its entries are the Sin[alpha] and Cos[alpha] from your formula.

有了您的电话号码,您就可以得到

With your numbers, you get

[A  E/2]   [-0.74248  0.66987]   [-10.369  0     ]   [-0.74248 -0.66987]
[E/2  B] = [-0.66987 -0.74248] * [ 0      -9.1715] * [ 0.66987 -0.74248]

三个因子中的第一个是由特征向量形成的矩阵,每个特征向量都归一化为单位长度.中心矩阵在对角线上具有特征值,最后一个是第一个的转置.如果将向量(x,y)与最后一个矩阵相乘,则将更改坐标系,以使混合项消失,即x和y轴平行于椭圆的主轴.这就是您想要的公式中发生的事情,所以现在您知道了

The first of the three factors is the matrix formed by the eigenvectors, each normalized to unit length. The central matrix has the eigenvalues on the diagonal, and the last one is the transpose of the first. If you multiply the vector (x,y) with that last matrix, then you will change the coordinate system in such a way that the mixed term vanishes, i.e. the x and y axes are parallel to the main axes of your ellipse. This is just what happens in your desired formula, so now you know that

Cos[alpha] = -0.74248  (-0.742479398678 with more accuracy)
Sin[alpha] =  0.66987  ( 0.669868899516)

翻译

如果将上述公式中的行向量[C D]与三个矩阵中的第一个相乘,则此效果将完全抵消(x, y)与第三个矩阵的相乘.因此,在更改后的坐标系中,您将中心对角矩阵用于二次项,并将此乘积用于线性项.

Translation

If you multiply the row vector [C D] in the above formula with the first of the three matrices, then this effect will exactly cancel the multiplication of (x, y) by the third matrix. Therefore in that changed coordinate system, you use the central diagonal matrix for the quadratic term, and this product for the linear term.

                     [-0.74248  0.66987]
[1.68052, 4.89519] * [-0.66987 -0.74248] = [-4.5269 -2.5089]

现在,您必须分别为xy 完成正方形,最终会得到一个表格,您可以从中读取中心坐标.

Now you have to complete the square independently for x and y, and you end up with a form from which you can read the center coordinates.

-10.369x² -4.5269x = -10.369(x + 0.21829)² + 0.49408
-9.1715y² -2.5089y = -9.1715(y + 0.13677)² + 0.17157

h = -0.21829  (-0.218286476695)
k = -0.13677  (-0.136774259156)

请注意,hk描述了已经旋转的坐标系中的中心;要获得原始中心,您需要再次将其与第一个矩阵相乘:

Note that h and k describe the center in the already rotated coordinate system; to obtain the original center you'd multiply again with the first matrix:

[-0.74248  0.66987]   [-0.21829]   [0.07045]
[-0.66987 -0.74248] * [-0.13677] = [0.24778]

符合您的描述.

以上完成的正方形为常数因子F贡献了更多的条件:

The completed squares above contributed some more terms to the constant factor F:

6.09234 + 0.49408 + 0.17157 = 6.7580

现在将其移到方程式的右侧,然后将整个方程式除以该数字,以便从所需的形式中获得= 1.然后您可以推导半径.

Now you move this to the right side of the equation, then divide the whole equation by this number so that you get the = 1 from your desired form. Then you can deduce the radii.

1    -10.369
-- = ------- = 1.5344
r²   -6.7580

1    -9.1715
-- = ------- = 1.3571
s²   -6.7580

r = 0.80730  (0.807304599162099)
s = 0.85840  (0.858398019487315)

验证结果

现在让我们检查一下我们是否犯了任何错误.使用我们找到的参数,您可以将方程拼凑起来

Verifying the result

Now let's check that we didn't make any mistakes. With the parameters we found, you can piece together the equation

  ((-0.74248*x - 0.66987*y + 0.21829)^2)/(0.80730^2)
+ (( 0.66987*x - 0.74248*y + 0.13677)^2)/(0.85840^2) = 1

1移到左侧,然后乘以-6.7580,您应该得到原始方程式.

Move the 1 to the left side, and multiply by -6.7580, and you should end up with the original equation. Expanding that (with the extra precision versions printed in parentheses), you'll get

-9.8317300000 x^2
-1.1913300000 x y
+1.6805200000 x
-9.7089100000 y^2
+4.8951900000 y
+6.0923400000

这是您输入内容的完美匹配.

which is a perfect match for your input.

这篇关于椭圆的标准形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆