How to define an ellipse by the eigendecomposition of its transformation matrix?
14 ビュー (過去 30 日間)
古いコメントを表示
I'm trying to establish the correct setup for defining an ellipse as a 'stretch' of a circle and a rotation of the result. For simplicity assume the centres of the circle and therefore the ellipse to be
so that the equation of the ellipse is
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131725/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131730/image.png)
Now let the eigenvalues of
be
and
so that the 'stretch' matrix is
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131735/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131740/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131745/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131750/image.png)
and let the rotation, counter-clockwise, of an angle θ from the x-axis be achieved by the transformation
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131755/image.png)
Since
,
is an admissible matrix of eigenvectors and it should be possible to express
as the product of its eigendecomposition by
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131760/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131765/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131770/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131775/image.png)
However, when I perform the reverse operation in practice, clearly something in the above is not correct, but I'm not sure what it is. The code snippet below illustrates the issue for
and
,
. What is it I'm getting wrong?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131780/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131785/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1131790/image.png)
>> theta = pi/4
theta =
0.7854
>> R = [cos(theta) sin(theta); -sin(theta) cos(theta)]
R =
0.70711 0.70711
-0.70711 0.70711
>> S = [1 0; 0 4]
S =
1 0
0 4
>> A = R*S*R'
A =
2.5 1.5
1.5 2.5
>> [V,D] = eig(A)
V =
-0.70711 0.70711
0.70711 0.70711
D =
1 0
0 4
>> V*D*V'-A
ans =
-4.4409e-16 -4.4409e-16
-4.4409e-16 -4.4409e-16
>>
8 件のコメント
William Rose
2022 年 9 月 21 日
In case you are still wondering about the sign in the rotation matrix, in which you had
R1=[cos(t), sin(t); -sin(t), cos(t)]
R2=[cos(t), -sin(t); sin(t), cos(t)]
The difference is that
y1=R1*x is equivalent to rotating the axes CCW by angle t. y1 is x, expressed in terms of the rotated axes.
y2=R2*x is equivalent to rotating the points CCW by angle t. y2 is the rotated x. The axes are unaltered.
By the way, when viewing plots of ellipses, you may want to use axis equal so that the aspect ratio is correctly represented.
採用された回答
Torsten
2022 年 9 月 21 日
移動済み: Walter Roberson
2022 年 9 月 21 日
phi = linspace(0,2*pi,100);
S = [1 0;0 4];
xy = S*[cos(phi);sin(phi)];
theta = pi/4;
Sxy = [cos(theta) -sin(theta);sin(theta) cos(theta)]*xy;
hold on
plot(xy(1,:),xy(2,:))
plot(Sxy(1,:),Sxy(2,:))
hold off
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!