CostNM:
--------------------------------------------------------------------------
Computes the cost functional for the Nelder-Meade algorithm
for least-squares attitude determination.
------------------------------------------------------------------------
Form:
J = CostNM( 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
-------
Outputs
-------
J Cost
--------------------------------------------------------------------------
Children:
SAAD: SAAttDet/FXNM