% Attitude Determination example
%
%     Copyright Tatsuaki Hashimoto  2008.12.5
%
%

 clear;

% star catalogue
% right ascension, declination
% alpha-CMi Procyon
 star(1,:) = [114.827242 5.227508];
% beta-Gem Pollux
 star(2,:) = [116.330683 28.026310];
% alpha-Leo Regulus
 star(3,:) = [152.093581 11.967195];
 
 % convert to unit vector
 for i = 1:3,
    starvect_inert(:,i) = alpdelt2uvect(star(i,1),star(i,2))';
 end
 % 

 % observed star
 starvect_obs(:,1) = [  0.903803  0.091111  -0.418137]';
 starvect_obs(:,2) = [  0.791148  0.469877  -0.391537]';
 starvect_obs(:,3) = [  0.457857  0.207352  -0.864507]';
 
 % attitude
 ATT = starvect_obs * inv(starvect_inert)
 
 q = dcm2q (ATT)