I have a rotation matrix from one basis to another:
Rot = [0.1227 0.0269 -0.9921;...
0.8635 -0.4956 0.0934;...
0.4892 0.8681 0.0840];
I use MATLAB rotm2eul
function to get the Euler angles in 'ZYZ' convention:
eulZYZ = rotm2eul(Rot,"ZYZ")
which is -0.0938 -1.4867 -1.0577
. If I use the inverse function eul2rotm
:
RotMATLAB = eul2rotm(eulZYZ,"ZYZ");
the result is different from Rot
(except the third column):
RotMATLAB =
-0.0406 0.1189 -0.9921
-0.8712 0.4819 0.0934
0.4892 0.8681 0.0840
What is going on? I thought that once you specified the 'ZYZ' there exists only one rotation.
Rotation matrices generally are assumed to have determinant 1
, but your "rotation" matrix Rot
has determinant det(Rot) = -1
, which means that your matrix also contains a (odd) number of reflections, not only rotations.
So there is no hope for rotm2eul
to produce any meaningful output for this matrix. Try doing the same by e.g. first multiplying your own matrix by a reflection matrix to ensure that Rot
has determinant 1
, like
diag([1,1,-1])