The Clohessy–Wiltshire equations describe the relative motion of one spacecraft in the neighborhood of another that shares a circular orbit, the standard linear model for rendezvous and station-keeping. This example builds that model as an input–output system and brings it to life with real entity data: the Hubble Space Telescope sets the orbit’s mean motion, and Space Shuttle Endeavour on mission STS-61 — the 1993 first servicing flight — plays the chaser. The result ties an abstract control model to an actual rendezvous, and places the relative motion back onto Hubble’s true orbit around the Earth.
The Clohessy-Wiltshire equations:
In[]:=
Columneqns=x''[t]==3
2
n
x[t]+2ny'[t]+
u
x
[t]m,​​y''[t]==-2nx'[t]+
u
y
[t]m,​​z''[t]==-
2
n
z[t]+
u
z
[t]m,
opts

Out[]=
′′
x
[t]3.71772×
-6
10
x[t]+0.00012483
u
x
[t]+0.00222642
′
y
[t]
′′
y
[t]0.00012483
u
y
[t]-0.00222642
′
x
[t]
′′
z
[t]-1.23924×
-6
10
z[t]+0.00012483
u
z
[t]
The model labels:
In[]:=
labels={{
u
x
,
u
y
,
u
z
},{x,y,z},{x,x',y,y',z,z'}};
The state space model:
In[]:=
ssm=StateSpaceModel[eqns,{x[t],y[t],z[t]},{
u
x
[t],
u
y
[t],
u
z
[t]},{x[t],y[t],z[t]},t,SystemsModelLabels->labels]
Out[]=

​
​
u
x
u
y
u
z
x
0.
1.
0.
0.
0.
0.
0
0
0
′
x
3.71772×
-6
10
0.
0.
0.00222642
0.
0.
0.00012483
0
0
y
0.
0.
0.
1.
0.
0.
0
0
0
′
y
0.
-0.00222642
0.
0.
0.
0.
0
0.00012483
0
z
0.
0.
0.
0.
0.
1.
0
0
0
′
z
0.
0.
0.
0.
-1.23924×
-6
10
0.
0
0
0.00012483
x
1
0
0
0
0
0
0
0
0
y
0
0
1
0
0
0
0
0
0
z
0
0
0
0
1
0
0
0
0
The mass of the STS-61 Space Shuttle:
In[]:=
m=QuantityMagnitudeUnitConvertMannedSpaceMissionData
,"Mass","Kilograms"
Out[]=
8011.0
The Hubble Space Telescope (HST) data:
In[]:=
hubble=SatelliteData

Out[]=
Hubble Space Telescope
It’s mean motion:
In[]:=
n=2πQuantityMagnitude[UnitConvert[hubble["MeanMotion"],"Revolutions"/"Seconds"]]
Out[]=
0.00111321
Simulate the CW model to obtain the space shuttle’s relative trajectory:
In[]:=
x0={500,0,-10000,-2n500,0,0};
In[]:=
or=OutputResponse[{ssm,x0},{0,0,0},{t,0,2π/n}]
Out[]=
InterpolatingFunction
Domain: 0.,5.64×
3
10

Output: scalar
[t],InterpolatingFunction
Domain: 0.,5.64×
3
10

Output: scalar
[t],InterpolatingFunction
Domain: 0.,5.64×
3
10

Output: scalar
[t]
In[]:=
sts61Orbit=ParametricPlot3Dor,{t,0,2π/n},
opts

Out[]=
The orbital parameters of the HST:
parsHST=Table[SatelliteData[hubble,prop],{prop,{"SemimajorAxis","Inclination","PeriapsisArgument","Eccentricity"}}];
In[]:=
{a,inc,ω,e}=Join[QuantityMagnitude[MapThread[UnitConvert,{Table[parsHST[[i]],{i,3}],{"Meters","Radians","Radians"}}]],{parsHST[[4]]}]
Out[]=
{6.85163×
6
10
,0.496934,3.02391,0.000164}
The orbit ellipse in the perifocal frame:
In[]:=
perifocal[ν_]:=With[{r=a(1-
2

)/(1+eCos[ν])},{rCos[ν],rSin[ν],0}]
The rotation from the perifocal frame to Earth-centered coordinates:
In[]:=
MatrixForm[q=RotationMatrix[Ω,{0,0,1}].RotationMatrix[inc,{1,0,0}].RotationMatrix[ω,{0,0,1}]/.Ω->1]
Out[]//MatrixForm=
-0.623416
0.671138
0.401156
-0.779884
-0.570467
-0.25758
0.0559752
-0.473435
0.879049
A plot of the HST’s reference orbit around the Earth:
In[]:=
orbit=ParametricPlot3D[q.perifocal[ν],{ν,0,2Pi}]
Out[]=
The Hill-frame axes along Hubble’s orbit, in Earth-centered coordinates:
In[]:=
rHat=q.{Cos[nt],Sin[nt],0};​​vHat=q.{-Sin[nt],Cos[nt],0};​​hHat=q.{0,0,1};
A factor to exaggerate the small relative separation:
In[]:=
scale=100;​​hubbleECI=arHat;​​shuttleECI=arHat+scale(or[[1]]rHat+or[[2]]vHat+or[[3]]hHat);
The Earth’s radius:
In[]:=
r

=QuantityMagnitudeUnitConvert
,"Meters"
Out[]=
6.371009×
6
10
Both spacecraft orbits about the Earth:
bothOrbits=ParametricPlot3D{hubbleECI,shuttleECI},{t,0,2Pi/n},
opts
;
In[]:=
earth=Graphics3D[{Blue,Specularity[White,15],Sphere[{0,0,0},
r

]}];
In[]:=
Showearth,bothOrbits,
opts

Out[]=
Hubble
Endeavour (STS-61)

CITE THIS NOTEBOOK

Clohessy-Wiltshire input-output model calibrated to Hubble and Endeavour STS-61 data​
by Maher Kuzbari​
Wolfram Community, STAFF PICKS, August 26, 2026
​https://community.wolfram.com/groups/-/m/t/3787698