A classical Euler rotation involves first a rotation about e3 axis, then one about the e1 axis and finally a rotation about the e3 axis.
% Compute the elements of rotation matrix R clc; psi = pi/4; theta = pi/4; fi = pi/6; R3_psi = [cos(psi) sin(psi) 0; -sin(psi) cos(psi) 0; 0 0 1] R1_theta = [1 0 0; 0 cos(theta) sin(theta); 0 -sin(theta) cos(theta)] R3_fi = [cos(fi) sin(fi) 0; -sin(fi) cos(fi) 0; 0 0 1]
R3_psi = 0.7071 0.7071 0 -0.7071 0.7071 0 0 0 1.0000 R1_theta = 1.0000 0 0 0 0.7071 0.7071 0 -0.7071 0.7071 R3_fi = 0.8660 0.5000 0 -0.5000 0.8660 0 0 0 1.0000
Multiplying each rotation matrix
R = R3_fi*R1_theta*R3_psi
R = 0.3624 0.8624 0.3536 -0.7866 0.0795 0.6124 0.5000 -0.5000 0.7071
From Rotation Matrix Compute Quaternion
q4 = 0.5*(1 + R(1,1)+ R(2,2) + R(3,3))^0.5; q1 = (R(2,3) - R(3,2))/(4*q4); q2 = (R(3,1) - R(1,3))/(4*q4); q3 = (R(1,2) - R(2,1))/(4*q4); q = [q1 q2 q3 q4] norm_q = norm(q) % Checking that the norm of q = 1 qv = [q1 q2 q3];
q = 0.3794 0.0500 0.5624 0.7330 norm_q = 1.0000
Compute Euler axis and its components along the axis E1,E2,E3 unit vector. Compute the Euler principle angle.
Euler_angle = 2*acos(q4)*180/pi % [deg] Euler_axis = qv/sind(Euler_angle/2) % [E1,E2,E3] norm_E = norm(Euler_axis)
Euler_angle = 85.7293 Euler_axis = 0.5577 0.0734 0.8268 norm_E = 1.0000