Code covered by the BSD License

# Absolute angular acceleration

% Example 10.4, Orbital Mechanics for Engineering Students, 2nd Edition.

absolute_angular_acceleration.m
%%
% Example 10.4, Orbital Mechanics for Engineering Students, 2nd Edition.
% The inertial components of the angular momentum of a torque-free rigid
% body are
Hg = [320; -375; 450 ];       %[kg*m^2/s] IJK
% the Euler angles [deg] are
fi      =  20;
theta   =  50;
psi     =  75;
% The inertia tensor in the body-fixed principal frame is
Ig = [1000, 0,    0;
0, 2000, 0;
0, 0,    3000]; %[kg*m^2]
%%
% Obtain the inertial components of the (absolute) angular acceleration
% Matrix of the transformation from body-fixed frame to inertial frame

QxX = [-sind(fi)*cosd(theta)*sind(psi) + cosd(fi)*cosd(psi), ...
-sind(fi)*cosd(theta)*cosd(psi) - cosd(fi)*sind(psi),sind(fi)*sind(theta);
cosd(fi)*cosd(theta)*sind(psi) + sind(fi)*cosd(psi),...
cosd(fi)*cosd(theta)*cosd(psi) - sind(fi)*sind(psi),-cosd(fi)*sind(theta);
sind(theta)*sind(psi),   sind(theta)*cosd(psi),    cosd(theta)
]
%%
% Matrix of the transformation from inertial frame to body-fixed frame
QXx = QxX'
%%
% Obtain the components of HG in the body frame
Hgx = QXx*Hg            % [kg*m^2/s]
%%
% The components of angular velocity in the body frame
Ig_inv = inv(Ig);