Multiplication of tranformation matrices gives strange result
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jessica
am 27 Nov. 2020
Beantwortet: Bjorn Gustavsson
am 27 Nov. 2020
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 Kommentare
Akzeptierte Antwort
Bruno Luong
am 27 Nov. 2020
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).
0 Kommentare
Weitere Antworten (1)
Bjorn Gustavsson
am 27 Nov. 2020
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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!