Demonstrate QFromU which performs static attitude determination.
Given 2 or more vectors QFromU will determine the attitude using least squares. ------------------------------------------------------------------------- See also Q2Mat, QRand, Plot2D, Unit, QFromU -------------------------------------------------------------------------
Contents
%------------------------------------------------------------------------------- % Copyright (c) 2001 Princeton Satellite Systems, Inc. % All rights reserved. %-------------------------------------------------------------------------------
Internal Demo
QFromU; m = 31; nE = zeros(1,m); n = zeros(1,m); for k = 1:m n(k) = 3 + k; uCatalog = Unit(rand(3,n(k))); m = Q2Mat( QRand ); uMeas = m*uCatalog; uMeas(:,3) = Unit(rand(3,1)); % Bad measurement [qE, mE] = QFromU( uCatalog, uMeas ); nE(k) = norm(eye(3) - mE'*m); end Plot2D( n, nE, 'Number of Measurements', 'Norm Error', 'QFromUDemo', 'ylog') %--------------------------------------
qTest = 0.62166 0.72124 -0.16742 0.2556 qFound = 0.62166 0.72124 -0.16742 0.2556