Rotating a coordinate with a rotation matrix
古いコメントを表示
So I'm working with a rotation matrix, basically trying to simulate

Where
and
are coordinates. H is a transformation matrix such as rotation
rot = [cosd(5),sind(5);-sind(5),cosd(5)];
Now, according to the equation, multiplying the transformation matrix with a coordinate
would result in a coordinate
but if
is [9,1] for example, if i multiply with the rotation matrix.
test_coor = [9;1];
h = [cosd(5),sind(5);-sind(5),cosd(5)];
out = test_coor * h;
I would get:
out =
9.0529
0.2118
But it's in decimals. So do i have to round it up the values after? Or am i supposed to do something with it to get
?
3 件のコメント
Bruno Luong
2019 年 9 月 10 日
編集済み: Bruno Luong
2019 年 9 月 10 日
Why you want to round up? The coordinates are real numbers, that might contain fractional part.
Stewart Tan
2019 年 9 月 10 日
Bruno Luong
2019 年 9 月 10 日
編集済み: Bruno Luong
2019 年 9 月 10 日
So you want to find out the (xi,yi) such that
H*[xi,yi] = [9;1] % 1 or 0, make your own mind
?
In that case
H = [cosd(5),sind(5);-sind(5),cosd(5)];
xy_j = [9;1];
xy_i = H'xy_j
you can then check
H*xy_i
採用された回答
その他の回答 (1 件)
Timothy Simon Thomas
2020 年 5 月 30 日
編集済み: Timothy Simon Thomas
2020 年 5 月 30 日
Rotation Matrix acting on a Vector
Parameters
Theta holds the angle to be rotated by, vector is the initial vector.
vector=[1;6]
theta=270;
Plot Initial Vector
plot([0 vector(1)],[0 vector(2)],'r--^','LineWidth',2);
title("Vector Rotation","BackgroundColor",'y')
hold on;
Rotation Matrix
2D-rotation matrix on the X-Y plane.
Rot_by_theta=[cosd(theta) -sind(theta) ; sind(theta) cosd(theta)]
Rotate
Multiply the initial vector with the rotation matrix to get the rotated vector.
rotated_vector=(Rot_by_theta*vector);
Plot Rotated Vector
Insert 0 at the begining to visualize the vector
plot([0 rotated_vector(1)],[0 rotated_vector(2)],'m-o','LineWidth',2);
legend("Ini_vector","Rotated")
Aesthetics
Draws X-Y axes, sets limts between -10 and 10 on both axes
grid on
xlim([-10 10])
ylim([-10 10])
line([xlim],[0 0]);
line([0 0],[ylim]);
hold off
カテゴリ
ヘルプ センター および File Exchange で Interpolation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




