Euler Angles from Rotation Matrix
조회 수: 41 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
채택된 답변
David Goodmanson
2021년 3월 7일
편집: David Goodmanson
2021년 3월 7일
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.
댓글 수: 3
David Goodmanson
2021년 3월 11일
Depending on your convention, you might have to use
R3(g)R1(b)R3(a) instead of R3(a)R1(b)R3(g). a,b,g = alpha,beta,gamma
For euler angles, if all three of them have the domain 0<=angle<=2*pi, then for every physical rotation there are two different sets of angles that give the same 3d rotation. This is not a good situation. Restricting one of the angles to 0<=angle<=pi gets rid of that problem, and the restriced set of angles still cover every possible 3d rotation.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Coordinate Systems에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!