CostNMTE:

--------------------------------------------------------------------------
   Computes the cost functional for the Nelder-Meade algorithm 
   for least-squares attitude determination.
   Dihedral angles are replaced by trailing edge angles.
--------------------------------------------------------------------------
   Form:
   J = CostNMTE( x, kX, S0, xA, lX )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   x                      State
   kX                     Subindex for states to be used
   S0                     Inverse of initial state covariance
   xA                     Initial state
   lX                     Length of the state vector
   type1                  Type of dihedral angle used for HSA1  
   type2                  HSA2: 'leading' 'trailing' or 'midscan'(default)

   -------
   Outputs
   -------
   J                      Cost

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

Children:

SAAD: SAAttDet/FXNMTE