Test a nonlinear equation solver for computing cone and clock.

The input is the costate vector and optical properties.
Functions demonstrated:
   LambdaToConeClock3D
Since version 7.
----------------------------------------------------------------------
See also Cone, Constant, Plot2D, RVFromKepler, RVToMEq,
LambdaToConeClock3D
------------------------------------------------------------------------
%------------------------------------------------------------------------
%	Copyright (c) 2005 Princeton Satellite Systems, Inc.
%   All rights reserved.
%------------------------------------------------------------------------

aU       = Constant('au');
d.mu     = Constant('mu sun');

d.rhoS   = 0.98;
d.rhoR   = 0.1;
d.rhoAD  = 0.00001; % If this is large it will not find a solution

d.accel  = 1e-6*aU^2; % Nominal sail acceleration

[r, v]   = RVFromKepler([aU 0 0 0 0 0], [], d.mu ); % Compute an orbit
n        = size(r,2);
x        = zeros(12,n);
for k = 1:n
  x(1:6,k)  = RVToMEq( r(:,k), v(:,k), d.mu );
  x(7:12,k) = 20*(rand(6,1)-0.5); % Random costates
end

[a, cone, clock] = LambdaToConeClock3D( x, 'equinoctial', d );

yL = {'Cone (rad)' 'Clock (rad)'};
Plot2D( 1:n, [cone; clock], 'Step', yL, 'Cone and Clock Solver')


%--------------------------------------
% PSS internal file version information
%--------------------------------------