Ellipsoid minimum distance demo
Since version 7. ------------------------------------------------------------------------ See also Eul2Mat, Plot2D, DistantPtToEll ------------------------------------------------------------------------
------------------------------------------------------------------------- Copyright 2005 Princeton Satellite Systems, Inc. All rights reserved. -------------------------------------------------------------------------
a = 15; S0 = diag(a*[0.5 1 0.5]).^2; kP = 50; kAxis = [1 2 3]; xc = [1.5;2;2]*a; angle = linspace(0,2*pi,kP+1); d = zeros(length(kAxis),kP); tE = d; for j = 1:length(kAxis) eul = [0;0;0]; for k = 1:kP eul(kAxis(j)) = angle(k); B = Eul2Mat(eul); S1 = B*S0*B'; tic [U,S] = svd(S1); [d(j,k),x] = DistantPtToEll(U,S,xc,[0;0;0]); tE(j,k) = toc; end end Plot2D(angle(1:end-1),d,'Rotation (rad)','Minimum Distance','Minimum Distance to an Ellipsoid') legend('x','y','z') Plot2D(angle(1:end-1),tE,'Rotation (rad)','Execution Time (sec)','Minimum Distance to an Ellipsoid') %-------------------------------------- % PSS internal file version information %--------------------------------------