52 views (last 30 days)

Show older comments

Hello!

I'm trying to get symbolic form of alpha, beta, gamma angles from a rotation matrix R in the sequence 3-1-3 (i.e. first rotation of gamma about Z axis, then a rotation of alpha about X axis and finally a rotation of gamma about Z axis) but I don't know how to do so.

Could someone can help me?

Thank you!

syms alpha beta gamma

R1 = [1, 0, 0; 0, cos(alpha), -sin(alpha); 0, sin(alpha), cos(alpha)]; % Rotation matrix about X axis of an angle alpha

R3 = [cos(gamma), -sin(gamma), 0; sin(gamma), cos(gamma), 0; 0, 0, 1]; % Rotation matrix about Z axis of an angle gamma

R313 = R3*R1*R3; % Final rotation matrix in the sequence 3-1-3

David Goodmanson
on 7 Mar 2021

Edited: David Goodmanson
on 7 Mar 2021

Hi Gregory,

If you mean you want the form of the rotation martrix in terms of alpha,beta,gamma, that's just

syms a b g

R1 = [1, 0, 0; 0, cos(b), -sin(b); 0, sin(b), cos(b)];

R3m = [cos(a), -sin(a), 0; sin(a), cos(a), 0; 0, 0, 1];

R3n = [cos(g), -sin(g), 0; sin(g), cos(g), 0; 0, 0, 1];

Rtot = R3m*R1*R3n

Rtot =

[cos(a)*cos(g) -cos(b)*sin(a)*sin(g), -cos(a)*sin(g) -cos(b)*cos(g)*sin(a), sin(a)*sin(b)]

[cos(g)*sin(a) +cos(a)*cos(b)*sin(g), cos(a)*cos(b)*cos(g) -sin(a)*sin(g), -cos(a)*sin(b)]

[ sin(b)*sin(g), cos(g)*sin(b), cos(b)]

If you mean you have a rotation matrix M and need expressions for a,b,g then

b = acos(M33) % M33 = M(3,3) etc.

Two choices here; b and (2*pi-b) are possible since cos is the same either way. That essentially means you get to pick the sign of sin(b). Denote that sign by S. Then

g = atan2(S*M31,S*M32)

a = atan2(S*M13,-S*M23)

Generally one of the euler angles is restricted to 0,theta<pi. That might or might not determine the angle b uniquely.

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

Start Hunting!