matrix determined by eul2rotm does not match a matrix calculated by euler angles using rotm2eul

I calcurated euler angles from a rotation matrix using "rotm2eul".
And I tried to confirm if a matrix calculated from the euler angles using "eul2rotm" corresponds to the original matrix.
However, the recalculated matrix did not correspond to the original one.
I used a sequence "XYZ" for both calcurations.
Is this conformation process wrong?
I would like to reproduce a rotation matrix using euler angles.
If anyone knows solutions about this, please let me know.
Sincerely,

7 commentaires

An example case of the rotation matrix you used would be helpful.
Thank your reactions.
I think the following RR1 should be correspond to R1. Is this process wrong?;
**************************
R1=[ -0.9978 0.0060 0.0661
-0.0029 -0.9989 0.0459
-0.0663 -0.0456 -0.9968];
eul1= rotm2eul(R1, 'XYZ');
eul1= -3.0955 0.0661 -3.1356;
RR1= eul2rotm(eul1, 'XYZ');
RR1=[ -0.9978 0.0060 0.0661
0.0090 0.9989 0.0459
-0.0657 0.0464 -0.9968];
**************************
I tried another matrix for exmaple;
R2=[ -0.6979 0.1609 -0.6979
0.3780 0.9104 -0.1681
-0.6083 0.3811 0.6962];
This makes eul2= -2.2522 -0.8809 -2.0877;
RR2=[ -0.3145 0.5533 -0.7713
0.2515 0.8321 0.4943
0.9153 -0.0385 -0.4009].
Hello Akiko,
Since I don't have the appropriate toolbox, it's hard to check this directly.
(Maybe someday Mathworks will have a "buy 80 different toolboxes, get one free" sale. Or maybe someday they will get justly concerned about the balkanization of their product and do some sensible consolodation).
It's easy to figure out the eul2rotm function, but not so easy for rotm2eul. Until you get an answer on this, you might want to try
eul2 = rotm2eul(R2, 'XYZ');
RR2 = eul2rotm(eul2, 'ZYX'); % reversed
just to see what happens. Or other variations on this theme, such as reversing the order of eul2 before feeding it to eul2rotm. For seeing the differences, your case 2 is better than case 1, since one of the angles in case 1 is quite small.
Thank you for your coment, David.
I tried as you told me.
I got same absoute values about each factor but the matrix is completely different.
R2=[ -0.6979 0.1609 -0.6979
0.3780 0.9104 -0.1681
-0.6083 0.3811 0.6962];
eul2 = rotm2eul(R2, 'XYZ');
This makes eul2= -2.2522 -0.8809 -2.0877;
RR2 = eul2rotm(eul2, 'ZYX');
RR2=[ 0.6962 0.3811 0.6083
0.1681 -0.9104 0.3780
0.6979 -0.1609 -0.6979];
Sorry for all, I inputted wrong rotation matrix whose determinant is -1.
This makes errors.
I got a solution about this already.
Sorry for bothreing you.
Especially, kind people who reacted to me, thank you for finding my small problem out of massive postings in the world.
Hello Akiko, it might be a small problem, but it's an interesting one, the finding that det = -1 changes things so radically.

Connectez-vous pour commenter.

Réponses (1)

When you feed in a rotation matrix to rotm2eul, if the matrix is not orthonormal, the rotm2eul will try to find the closest orthonormal matrix first. In that case if you try to convert the Euler angles back to rotation matrix, you won't get back the original one.

Catégories

Produits

Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by