CostLowThrust2D:

--------------------------------------------------------------------------
   Cost function for 2D low thrust trajectory optimization.
   It computes an err magnitude
   that the optimizer uses to find the minimum. \
   This function is for the planar orbit problem which includes
   radial position, radial velocity, tangential velocity and mass.
   This function is specifically for the minimum time problem.

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

   ------
   Inputs
   ------
   lambda         (3,1)  Costates [r;dr/dt;drtheta/dt]
   d              (1,1)  Structure
                         .rhsFun      (1,:) Associated RHS function for optimizer
                         .plotFun     (1,:) Associated plot function for optimizer
                         .thrust      (1,1) Thrust magnitude       
                         .m0          (1,1) Initial mass
                         .mF          (1,1) Fuel mass
                         .mDot        (1,1) Mass derivative
                         .x0          (3,1) Initial state from optimizer
                         .xF          (3,1) Final state from optimizer
                         .tEnd        (1,1) Final time from opimizer
                         .oDEOptions  (1,:) ode113 parameters
                         .errorScale  (3,1) Weights on the errors

   -------
   Outputs
   -------
   errMag         (1,:)  Magnitude of the error
   err            (4,1)  [costates;transversality condition]
   x              (:,n)  States
   t              (1,n)  Time

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

Children:

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