I am trying to find a Direction Cosine Matrix (DCM) for the Euler angle body 1-2-3 sequence. I tried making my own function and using the MATLAB function, but the result is matrices that are not equal to each other. But, if I were to use the 'ZYX' sequence, I would get a matrix that is equal to the transpose of the matrix produced by my function.I mean that transpose(EA123toDCM) = E123toDCM if I changed the sequence to 'ZYX'. I never got two equal matrices. Can you fix my code so I would get two equal DCM matrices for the body 1-2-3 sequence? Also, for the E123toDCM line, I am using the sequence 'XYZ'. Is that correct or should it be 'ZYX'? I know that that for a DCM of sequence 1-2-3 = R3(theta1)*R2(theta2)*R1(theta3). Is ZYX sequence the same as a 1-2-3 sequence?
I am trying to find a Direction Cosine Matrix (DCM) for the Euler angle body 1-2-3 sequence. I tried making my own function and using the MATLAB function, but the result is matrices that are not equal to each other. But, if I were to use the 'ZYX' sequence, I would get a matrix that is equal to the transpose of the matrix produced by my function.I mean that transpose(EA123toDCM) = E123toDCM if I changed the sequence to 'ZYX'. I never got two equal matrices. Can you fix my code so I would get two equal DCM matrices for the body 1-2-3 sequence?
Also, for the E123toDCM line, I am using the sequence 'XYZ'. Is that correct or should it be 'ZYX'? I know that that for a DCM of sequence 1-2-3 = R3(theta1)*R2(theta2)*R1(theta3). Is ZYX sequence the same as a 1-2-3 sequence?
EA = [pi/3; -pi/4; -pi/6];
EA123toDCM = EA123DCM(EA)
E123toDCM = angle2dcm(EA(1,1), EA(2,1), EA(3,1), 'XYZ')
function [R] = EA123DCM(EA)
theta1 = EA(1,1);
theta2 = EA(2,1);
theta3 = EA(3,1);
R1 = @(a)[1 0 0 ;
0 cos(a) -sin(a);
0 sin(a) cos(a)];
R2 = @(a)[cos(a) 0 sin(a) ;
0 1 0 ;
-sin(a) 0 cos(a)];
R3 = @(a)[ cos(a) -sin(a) 0;
sin(a) cos(a) 0;
0 0 1];
R = R3(theta1)*R2(theta2)*R1(theta3);
end
Trending now
This is a popular solution!
Step by step
Solved in 3 steps