Multiplication of tranformation matrices gives strange result

2 ビュー (過去 30 日間)
Jessica
Jessica 2020 年 11 月 27 日
回答済み: Bjorn Gustavsson 2020 年 11 月 27 日
So, I´m tasked with doing multiple tranformations on a matrix, by way of permutation-matrices.
In math this is done by multiplying the permutation-matrices in the right order and then multiplying the result with original matrix.
The results I have gotten is strange, and when I reverse the order of the permutation-matrices the results are the SAME, and really should Not be.
B = Batman;
x = B(1,:);
y = B(2,:);
%plot(x,y,'.');
Rccw60=[1/2, sqrt(3/2); -sqrt(3/2), 1/2];
Refy=[-1, 0; 0, 1];
Rd1 = [x(:),y(:)] * Rccw60;
Rd2 = [x(:),y(:)] * Refy;
Rd60ref = Rd1 .* Rd2; % this is reflected, but should be angled at 120ccw(because of later reflection)
x2d = Rd60ref(:,1);
y2d = Rd60ref(:,2);
plot(x2d,y2d,'.')
title ('Combination of rotation 60ccw and reflection on y-axis')
Rdref60 = Rd2 .* Rd1; % this looks as it should
x2d2 = Rdref60(:,1);
y2d2 = Rdref60(:,2);
plot(x2d2,y2d2,'.')
title ('Combination of reflection on y-axis and rotation 60ccw')
  6 件のコメント
Jessica
Jessica 2020 年 11 月 27 日
In a previous question, when I got an answer, there was a "accept answer" button, but there is not one now???
So, I do accept this answer, but I do not know how without button...
Jessica
Jessica 2020 年 11 月 27 日
So, answered that one.
Bruno, please answer this question, rather than commenting, then I can accept.

サインインしてコメントする。

採用された回答

Bruno Luong
Bruno Luong 2020 年 11 月 27 日
Your decription does not match with what your code is doing (your code)
You take T1 on (x,y) data
You take T2 on (x,y) data
Then take elementwise product of those results. Elementwise (Hadamard) product is commutative.
Which is completely different than (your description)
apply (T1*T2) on (x,y) data
and (T2*T1) on (x,y).

その他の回答 (1 件)

Bjorn Gustavsson
Bjorn Gustavsson 2020 年 11 月 27 日
You have confused permutation-matrices with mirroring and rotation-matrices. They are not the same. Your Rccw60 is not (what I think) you think it is. To check that you have a sensible rotation-matrix (as one can colclude from your naming and description of what it should do), you should verify that the product of the matrix and its transpose is close to the identity-matrix:
Rccw60*Rccw60.'
Which clearly is not an identity-matrix.
Once you've fixed that (simply a typo), you should also take Bruno's advice into account.
HTH

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by