Calculate the rotational angles of a transformed coordinate system

3 views (last 30 days)
Hello,
I'm struggeling with a coordinate system transformation. The original coordinate system (in black colour) is give by three vectors (XV, YV, ZV), each for every axis and the location of the origin (NP). The System of three Vectors is transformed (translation and rotation) so that the new system (in red colour) is formed (Picture below).
I need to calculate the rotational angle of the system regarding rotation aroound x, y, and z axis. I know I need the rotaional matrix but I don't have a clue to solve this problem. Maybe anyone of the community knows how get rid of the problem?
With best regards
Steffen B.
  2 Comments
Yazan
Yazan on 1 Jul 2021
Do you need to calculate the required rotation and translation? or do we need just the rotational matrices?
Steffen Bxyz
Steffen Bxyz on 3 Jul 2021
@Yazan I only need the rotation of the red coordinate system (formed by three vectors) around X,Y and Z axis compared to the former position (black system)

Sign in to comment.

Accepted Answer

Matt J
Matt J on 1 Jul 2021
Edited: Matt J on 1 Jul 2021
You can use the attached file to get the rotation angles (in degrees).
Rblack=normalize( [Xb(:),Yb(:),Zb(:)]-NPb(:) ,1,'norm'); %The black XV,YV,ZV, and NP
Rred=normalize( [Xr(:),Yr(:),Zr(:)]-NPr(:) ,1,'norm'); %The red XV,YV,ZV, and NP
angles = flip(rot2taitbryan(Rred*Rblack.' ,'ZYX'));
  8 Comments
Steffen Bxyz
Steffen Bxyz on 6 Jul 2021
@Matt J Thank you very much, it is working just fine. I have only one question regarding the theory behind it. When I try the different order of angles to return, the angles differ. If I use ZYX and XYZ the angles should be equal but in different order. ´The results are not equal. Is it because of the rotation and translation? Do I miss something?
Matt J
Matt J on 6 Jul 2021
Edited: Matt J on 7 Jul 2021
Thank you very much, it is working just fine.
You're welcome, but please Accept-click the answer to indicate so.
If I use ZYX and XYZ the angles should be equal but in different order.
No, that's not true, in general. Not sure why you think so.

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Products


Release

R2015b

Community Treasure Hunt

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

Start Hunting!