CostSail3D:

--------------------------------------------------------------------------
   Cost function for 3D solar sail trajectory optimization.
   It computes an err magnitude that the optimizer uses to find the
   minimum.

   This function is specifically for the minimum time problem.

   Since version 7.
--------------------------------------------------------------------------
   Form:
   [errMag, err, x, t] = CostSail3D( lambda, d )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   lambda         (6,1)  Costates [p;f;g;k;h;L]
   d              (1,1)  Structure
                         .rhsFun      (1,:)  Associated RHS function for optimizer
                         .plotFun     (1,:)  Associated plot function for optimizer
                         .accel       (1,1)  Sail acceleration
                         .mu          (1,1)  Gravitational parameter
                         .x0          (6,1)  Initial state from optimizer
                         .xF          (6,1)  Final state from optimizer
                         .tEnd        (1,1)  Final time from opimizer
                         .oDEOptions  (1,:)  ode113 options
                         .errorScale  (6,1)  Weights for the error

   -------
   Outputs
   -------
   errMag         (1,1)  Magnitude of the error
   err            (6,1)  Erors
   x              (:,n)  States
   t              (1,n)  Time

--------------------------------------------------------------------------

Children:

Common: Database/Constant
Math: Linear/DupVect
Math: Linear/Mag
SC: Ephem/Planets