Small Satellites

Home » Posts tagged 'Rotation matrix'

Tag Archives: Rotation matrix

Rodrigues Parameters from Rotation Matrix

In this example we derive Rodrigues parameters/Gibbs Vector from the rotation matrix elements. The Rodrigues parameters have a singularity at 180 deg and use is limited for principal rotations which are less than 180 deg.

clc; clear all;
% Rotation matrix
Rm = [0.36   0.48  -0.8;
     -0.8    0.6    0;
      0.48   0.64   0.6 ];

g1 = (Rm(2,3)- Rm(3,2))/(1 + trace(Rm));
g2 = (Rm(3,1)- Rm(1,3))/(1 + trace(Rm));
g3 = (Rm(1,2)- Rm(2,1))/(1 + trace(Rm));
G = [g1 g2 g3]'
G =

   -0.2500
    0.5000
    0.5000

 

Advertisements

Euler rotation example, Rotation matrix, Quaternion, Euler Axis and Principal Angle

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

 

%d bloggers like this: