Filter löschen
Filter löschen

Rotate a 4D matrix

6 Ansichten (letzte 30 Tage)
Matt
Matt am 14 Okt. 2015
Kommentiert: Matt am 14 Okt. 2015
Hello,
I have a 4D matrix at the moment which contains coordinates (X, Y, Z). I would like to know how can I rotate that matrix easily? I know the rotation matrices in space (these are 3x3 matrices) upon X, Y, and Z axes but I fail to do in 1 line the rotation of my 4D matrix.
If I extract a single value from the matrix, and rotate it using a rotation matrix it works, but how can I rotate the whole 4D matrix? For example I extract a value of my 4D matrix:
AA=D(2,5,44,:)
I make sure I have the coordinates on 1 line:
AA2=AA(1,:)
I rotate the point:
AA2rot=AA2*Rotz
Rotz is a 3x3 rotation matrix. And this works, but how can I do it for all elements of my 4D matrix (D)?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 14 Okt. 2015
AA2 = reshape(D, [], 3);
AA2rot = AA2 * RotZ;
AArot = reshape(AA2rot, size(D));
  1 Kommentar
Matt
Matt am 14 Okt. 2015
Awesome thanks a lot! I learned the use of the reshape function. Very useful!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu 3-D Scene Control 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!

Translated by