MATLAB: How to rotate coordiante system about Z axis first then rotate about about the new Y axis.

coordinate system translateglobal coordinatematrix manipulation

Assume two coordinate systems, one is the global coordinate system(XYZ) and another is a local coordinate system which is obtained by rotating about the Z axis of the global coordinate system and then rotating about the new Y axis. how can I get the translated matrix of this process?

Best Answer

Hi Yang,
Suppose you have rotation matrices
Rx = [1 0 0 Ry = [c 0 -s Rz = [c -s 0
0 c -s 0 1 0 s c 0
0 s c] s 0 c] 0 0 1]
If p is the column vector [x;y;z], then for example pnew = Rx*p.
Here s is sin(theta), c = cos(theta), these are active rotations of the object, and looking down the axis of rotation toward the origin, the rotations are counterclockwise.
A rotation in z and then in the original y would be
vnew = Ry*Rz*v
A rotation in z and then in the new y is
vnew = Rz*Ry*v
which has the order reversed. That's because a rotation about the new y axis is equivalent to: rotate the new y axis back to the old y axis, then rotate about the old y axis, then rotate forward so that the old y axis is the new y axis.
Ry_new = Rz*Ry*Rz^(-1)
so
Ry_new*Rz = Rz*Ry*Rz^(-1)*Rz = Rz*Ry