CompareHills:

--------------------------------------------------------------------------
 Compare closed form Hills equations with other methods of propagation.

 We have two spacecraft flying in close proximity. Their relative motion
 may be expressed in the Hill's frame or the LVLH frame. Each is a 
 rotating coordinate system centered on the reference spacecraft. This
 function takes an initial relative state and computes their future 
 relative trajectories using a variety of different methods. These methods
 are described below:

 ABSOLUTE PROPAGATION ... then TRANSFORMATION
---------------------------------------------
 The two orbital element sets of [a i W w e M] are propogated over 
 time using 3 different methods: 
  - RVOrbgen (Keplerian elements), 
  - FOrb (numeric integration with inverse square law gravity model)
  - FOrbHF (numeric integration with 2 zonal, 2 tesseral harmonics)
 The resulting r & v ECI coordinates of the absolute orbits are then 
 transformed to the Hills frame for comparison. 

 TRANSFORMATION ... then RELATIVE PROPAGATION
---------------------------------------------
 We first convert the initial orbital elements to absolute position
 and velocity in the ECI frame. We then transform the 2 absolute 
 states to a relative state in the Hills frame. The relative position/
 velocity over time is solved using 2 different methods: 
  - HillsEqns (closed form solution of relative motion)
  - DiscreteHills (discretized state space propgation of linearized system)

 The table below outlines the different methods used:

  Propagation Frame       Model                   Line Color 
  ==========================================================
     Absolute          Keplerian                     Blue
     Absolute          Inverse Square Law            Green
     Absolute          Gravity Model with J2         Cyan
     Relative          Discretized state space       Red
     Relative          Hills Equations               Maroon

   Since version 7.
--------------------------------------------------------------------------
 Usage:  
 [t, xAbsKepler, xAbsLoFi, xAbsHiFi, xRelDiscProp, xRelHills] = TestHillsEqns( elRef, xH0, nOrbits );
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   elRef          (1,6)   Initial reference orbit elements [a i W w e M]
   xH0            (6,1)   Initial Hill's frame state [x;y;z; Vx;Vy;Vz]
   nOrbits         (1)    Number of orbits to simulate

   -------
   Outputs
   -------
   t              (1,:)   Time vector [sec]

     --- the following outputs are relative state time histories ---
        --- each state is computed in a different manner ---

   xAbsKepler     (6,:)   Orbits generated by propagating Keplerian elements
   xAbsLoFi       (6,:)   Lo-Fideltiy propagation of absolute orbits (simple inverse square law)
   xAbsHiFi       (6,:)   Hi-Fidelity propagation of absolute orbits (2 zonal and 2 tesseral harmonics)
   xRelDiscProp   (6,:)   Propagation of discretized linear equations of relative motion
   xRelHills      (6,:)   Relative motion computed using closed-form Hills equations

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

Children:

Common: Graphics/NewFig
Common: Time/JD2000
FormationFlying: Coord/PCState
FormationFlying: Dynamics/DiscreteHills
FormationFlying: Dynamics/HillsEqns
FormationFlying: Transformation/ECI2Hills
FormationFlying: Transformation/Hills2ECI
Math: Integration/RK4
Math: Linear/Mag
Orbit: GravityModels/LoadGravityModel
Orbit: OrbitMechanics/RVOrbGen
SC: BasicOrbit/OrbRate
SC: BasicOrbit/RV2El