My unpublished GPS notes.
Geometry
Conic Sections Dandelin spheres show that an ellipse is the locus of points with the property that the sum of distances from two foci is constant. $$ L = \norm{\r - \vec{f}_-} + \norm{\r - \vec{f}_+} $$ let $\vec{f}_{\pm} = \pm \ux c$ semi-major axis $a$ semi-minor axis $b$ linear eccentricity $c$ $$ L = c + a + [a - c] = 2 a $$ $$ \frac{x^2}{a^2} + \frac{y^2}{b^2} = 1 $$ $$ b^2 = a^2 - c^2 $$
$$
2 a = \sqrt{[x + c]^2 + y^2} + \sqrt{[x - c]^2 + y^2}
$$
square this to get
$$
\begin{split}
4 a^2 &= [x + c]^2 + y^2 + 2 \sqrt{[x + c]^2 + y^2} \sqrt{[x - c]^2 + y^2} + [x - c]^2 + y^2 \\
4 a^2 &= 2 x^2 + 2 y^2 + 2 c^2 + 2 \sqrt{[[x + c]^2 + y^2] [[x - c]^2 + y^2]} \\
2 a^2 &= x^2 + y^2 + c^2 + \sqrt{[x^2 + 2 x c + c^2 + y^2] [x^2 - 2 x c + c^2 + y^2]} \\
2 a^2 &= x^2 + y^2 + c^2 + \sqrt{x^4 - 2 x^3 c + x^2 c^2 + x^2 y^2 + 2 x^3 c - 4 x^2 c^2 + 2 x c^3 + 2 x y^2 c + x^2 c^2 - 2 x c^3 + c^4 + y^2 c^2 + x^2 y^2 - 2 x y^2 c + y^2 c^2 + y^4} \\
2 a^2 &- x^2 - y^2 - c^2 = \sqrt{x^4 + y^4 + c^4 - 2 x^2 c^2 + 2 x^2 y^2 + 2 y^2 c^2}
\end{split}
$$
square this to get
$$
\begin{split}
4 a^4 &- 4 a^2 x^2 - 4 a^2 y^2 - 4 a^2 c^2 + x^4 + 2 x^2 y^2 + 2 x^2 c^2 + y^4 + 2 y^2 c^2 + c^4 = x^4 + y^4 + c^4 - 2 x^2 c^2 + 2 x^2 y^2 + 2 y^2 c^2 \\
4 a^4 &- 4 a^2 x^2 - 4 a^2 y^2 - 4 a^2 c^2 + 4 x^2 c^2 = 0 \\
a^2 [a^2 - c^2] &= [a^2 - c^2] x^2 + a^2 y^2 \\
a^2 b^2 &= b^2 x^2 + a^2 y^2 \\
1 &= \frac{x^2}{a^2} + \frac{y^2}{b^2}
\end{split}
$$
$$
\begin{bmatrix} x \\ y \end{bmatrix}
=
\begin{bmatrix} a \cos \theta \\ b \sin \theta \end{bmatrix}
$$
eccentricity $e$
$$
e \equiv \frac{c}{a} = \sqrt{1 - \frac{b^2}{a^2}}
$$
semi-latus rectum $p$
Let $x = \pm c = \pm a e$. Then
$$
\frac{[\pm a e]^2}{a^2} + \frac{y^2}{b^2} = 1
$$
thus
$$
y = \pm b \sqrt{1 - e^2}
$$
$$
p = b \sqrt{1 - e^2} = a [1 - e^2] = \frac{b^2}{a}
$$
Polar Forms
Around the center of an ellipse $$ \boxed{r = a [1 - e \cos \theta]} $$
$$
\begin{split}
r &= \sqrt{[x - c]^2 + [y - 0]^2} \\
&= \sqrt{[a \cos \theta - c]^2 + b^2 \sin^2 \theta} \\
&= \sqrt{[a \cos \theta - a e]^2 + a^2 [1 - e^2] \sin^2 \theta} \\
&= \sqrt{a^2 \cos^2 \theta - 2 a^2 e \cos \theta + a^2 e^2 + a^2 \sin^2 \theta - a^2 e^2 \sin^2 \theta} \\
&= a \sqrt{1 - 2 e \cos \theta + e^2 [1 - \sin^2 \theta]} \\
&= a \sqrt{[1 - e \cos \theta]^2} \\
&= a [1 - e \cos \theta]
\end{split}
$$
Around a focus $$ \boxed{r = \frac{p}{1 + e \cos \theta}} $$
$$
2 a = \norm{\r} + \norm{\r - \ux 2 c}
$$
$$
2 a = r + \sqrt{[r \cos \theta - 2 c]^2 + [r \sin \theta]^2}
$$
$$
[2 a - r]^2 = [r \cos \theta - 2 c]^2 + [r \sin \theta]^2
$$
$$
4 a^2 - 4 a r + r^2 = r^2 \cos^2 \theta - 4 c r \cos \theta + 4 c^2 + r^2 \sin^2 \theta
$$
$$
a^2 - c^2 = r [a - c \cos \theta]
$$
$$
r
= \frac{b^2}{a - c \cos \theta}
= \frac{\frac{b^2}{a}}{1 - \frac{c}{a} \cos \theta}
= \frac{p}{1 - e \cos \theta}
$$
Orbital Mechanics
eccentric anomaly $E$ mean motion $n$ mean anomaly $M$ Kepler's Laws- Planet orbits trace out ellipses with sun at one focus
- Planet orbits sweep out equal area in equal time
- $T^2 \propto a^3$
Kepler Problem
$$ \begin{cases} \F_{12} = m_1 \a_1 = -G \frac{m_1 m_2}{R_{12}^2} \uR_{12} \\ \F_{21} = m_2 \a_2 = -G \frac{m_2 m_1}{R_{21}^2} \uR_{21} \end{cases} $$ $$\F_{12} = -\F_{21}$$ $$ \r_{CM} = \frac{m_1 \r_1 + m_2 \r_2}{m_1 + m_2} $$ $M = m_1 + m_2$ $$ m_1 \a_1 + m_2 \a_2 = \vec{0} $$ $$ \a_{CM} = \vec{0} $$ $$ \v_{CM} = \v_{CM,0} $$ $$ \L = \r_1 \cross \p_1 + \r_2 \cross \p_2 \\ $$ $$ \mathcal{L} = K - U $$ $$ \mathcal{L}(t, \r_1, \v_1, \r_2, \v_2) = \frac{1}{2} m_1 v_1^2 + \frac{1}{2} m_2 v_2^2 - U(\r_1, \r_2) $$ $$ \mu = \frac{m_1 m_2}{m_1 + m_2} $$ $$ \r_{21} = \r_2 - \r_1 $$ $$ \r_1 = \r_{CM} - \frac{m_2}{M} \r_{21} $$ $$ \r_2 = \r_{CM} + \frac{m_1}{M} \r_{21} $$ $$ \mathcal{L}(t, \r_{CM}, \v_{CM}, \r_{21}, \v_{21}) = \frac{1}{2} M v_{CM}^2 + \frac{1}{2} \mu v_{21}^2 - U(r_{21}) $$ $$ \begin{split} K &=\frac{1}{2} M v_{CM}^2 + \frac{1}{2} \mu v_{21}^2 \\ &= \frac{1}{2} M \frac{\sum_i [m_1 v_{1,i} + m_2 v_{2,i}]^2}{M^2} + \frac{1}{2} \frac{m_1 m_2}{M} \sum_i [v_{2,i} - v_{1,i}]^2 \\ &= \frac{1}{2 M} \sum_i [m_1^2 v_{1,i}^2 + 2 m_1 m_2 v_{1,i} v_{2,i} + m_2^2 v_{2,i}^2 + m_1 m_2 v_{2,i}^2 - 2 m_1 m_2 v_{1,i} v_{2,i} + m_1 m_2 v_{1,i}^2 ] \\ &= \frac{1}{2 M} \sum_i [[m_1 + m_2] m_1 v_{1,i}^2 + [m_1 + m_2] m_2 v_{2,i}^2] \\ &= \frac{1}{2} \sum_i [m_1 v_{1,i}^2 + m_2 v_{2,i}^2] \\ &= \frac{1}{2} m_1 v_1^2 + \frac{1}{2} m_2 v_2^2 \end{split} $$ $$\mathcal{L} = \mathcal{L}_{CM} + \mathcal{L}_{rel}$$ As shown, the CM is inertial, so choose to locate the origin at the CM which makes the CM kinect energy term zero $$ \mathcal{L}(t, \vec{0}, \vec{0}, \r_{21}, \v_{21}) = \frac{1}{2} \mu v_{21}^2 - U(r_{21}) $$ This is Lagrangian is identical in form to a single particle in an inverse square-law field.Using the TLE
The TLE gives mean motion, epoch, and mean anomaly at epoch, while the GPS measurement yields time $$ \boxed{n \equiv \frac{2 \pi}{T}} $$ compute mean anomaly as $$ \boxed{M = M_0 + n [t - t_0]} $$ Compute semi-major axis given mean motion and Earth's gravitational constant using Kepler's Law $$ \boxed{a = \bb{\frac{G [m + M_\oplus]}{n^2}}^{\frac{1}{3}} \approx \bb{\frac{G M_\oplus}{n^2}}^{\frac{1}{3}}} $$ Note, the earth gravitational constant is known to more significant figures than either factor. Compute semi-minor axis given semi-major axis and eccentricity $$ \boxed{b = a \sqrt{1 - e^2}} $$ Compute linear eccentricity given semi-major axis and eccentricity $$ \boxed{c = a e} $$ Compute eccentric anomaly given mean anomaly and eccentricity using Kepler's equation $$ \boxed{M = E - e \sin E} $$ This equation can't be solved analytically. Instead, solve it iteratively. For instance, use Newton's method. Another way proposed by [1] is to iterate over $$ E_{i+1} = E_i + \Delta E $$ $$ \Delta M = M - [E_i - e \sin E_i] $$ $$ \Delta E = \frac{\Delta M}{1 - e \cos E_i} $$ $E_0 = 0.0$ $\Delta E = M - e \sin M$ $\epsilon = 1.0e-8$ [rad] test $\abs{\Delta E} ≤ \epsilon$ test smaller than max iterations Finally, compute satellite position given semi-major axis, semi-minor axis, linear eccentricity, and eccentric anomaly $$ \boxed{\r = \begin{bmatrix} a \cos E - c \\ b \sin E \\ 0 \\ 1 \end{bmatrix}} $$Geodetic Stuff
parametric latitude $\beta$ geocentric latitude $\theta$ geodetic latitude $\phi$ geodetic longitude $\lambda$ geodetic height $h$ flattening $f$ $$ f \equiv 1 - \sqrt{1 - e^2} $$ecef <-> geodetic
$(\phi, \lambda, h) \rightarrow (x, y, z)$ $$ \boxed{ \begin{cases} x = [K a^2 + h] \cos \phi \cos \lambda \\ y = [K a^2 + h] \cos \phi \sin \lambda \\ z = [K b^2 + h] \sin \phi \end{cases} \quad\text{where}\quad K = \frac{1}{\sqrt{a^2 \cos^2 \phi + b^2 \sin^2 \phi}} } $$
$$
\frac{x^2}{a^2} + \frac{z^2}{b^2} = 1
$$
$$
\frac{2 x}{a^2} + \frac{2 z}{b^2} \pd{z}{x} = 0
$$
$$
\pd{z}{x} = - \frac{b^2}{a^2} \frac{x}{z}
$$
$$
\pd{z}{x} = -\tan \pp{\frac{\pi}{2} - \phi} = -\cot \phi
$$
$$
a^2 z \cos \phi = b^2 x \sin \phi
$$
$$
a^4 z^2 \cos^2 \phi = b^4 x^2 \sin^2 \phi
$$
$$
b^2 x^2 + a^2 z^2 = a^2 b^2
$$
$$
\begin{cases}
b^4 x^2 \sin^2 \phi + a^2 b^2 z^2 \sin^2 \phi = a^2 b^4 \sin^2 \phi \\
a^2 b^2 x^2 \cos^2 \phi + a^4 z^2 \cos^2 \phi = a^4 b^2 \cos^2 \phi
\end{cases}
$$
$$
\begin{cases}
a^2 z^2 [a^2 \cos^2 \phi + b^2 \sin^2 \phi] = a^2 b^4 \sin^2 \phi \\
b^2 x^2 [a^2 \cos^2 \phi + b^2 \sin^2 \phi] = a^4 b^2 \cos^2 \phi
\end{cases}
$$
$$
\begin{cases}
z \sqrt{a^2 \cos^2 \phi + b^2 \sin^2 \phi} = b^2 \sin \phi \\
x \sqrt{a^2 \cos^2 \phi + b^2 \sin^2 \phi} = a^2 \cos \phi
\end{cases}
$$
$$
\begin{cases}
z = K b^2 \sin \phi \\
x = K a^2 \cos \phi
\end{cases}
$$
where $K = [a^2 \cos^2 \phi + b^2 \sin^2 \phi]^{-\frac{1}{2}}$
$$
\begin{cases}
x = K a^2 \cos \phi \cos \lambda \\
y = K a^2 \cos \phi \sin \lambda \\
z = K b^2 \sin \phi
\end{cases}
$$
$$
\begin{cases}
x = [K a^2 + h] \cos \phi \cos \lambda \\
y = [K a^2 + h] \cos \phi \sin \lambda \\
z = [K b^2 + h] \sin \phi
\end{cases}
$$
$(x, y, z) \rightarrow (\phi, \lambda, h)$
$$
\boxed{
\begin{cases}
\phi = \atan \pp{ \frac{z}{\sqrt{x^2 + y^2}} \frac{[K a^2 + h]}{[K b^2 + h]} } \\
\lambda = \atantwo(y, x) \\
h = \frac{\sqrt{x^2 + y^2}}{\cos \phi} - K a^2
\end{cases}
\quad\text{where}\quad
K = \frac{1}{\sqrt{a^2 \cos^2 \phi + b^2 \sin^2 \phi}}
}
$$
These equations are coupled and must be solved iteratively.
$$
\lambda = \atantwo(y, x)
$$
$$
\sqrt{x^2 + y^2}
= \sqrt{[K a^2 + h]^2 \cos^2 \phi \cos^2 \lambda + [K a^2 + h]^2 \cos^2 \phi \sin^2 \lambda}
= [K a^2 + h] \cos \phi
$$
$$
h = \frac{\sqrt{x^2 + y^2}}{\cos \phi} - K a^2
$$
$$
\frac{z}{\sqrt{x^2 + y^2}} = \frac{[K b^2 + h] \sin \phi}{[K a^2 + h] \cos \phi}
$$
$$
\phi = \atan \pp{ \frac{z}{\sqrt{x^2 + y^2}} \frac{[K a^2 + h]}{[K b^2 + h]} }
$$
THE FOLLOWING IS IN SPHERICAL COORDINATES
spherical to rectangular matrix
$$
\boxed{
\ur =
\begin{bmatrix}
\sin \theta \cos \phi \\
\sin \theta \sin \phi \\
\cos \theta \\
0
\end{bmatrix}
\quad
\utheta =
\begin{bmatrix}
\cos \theta \cos \phi \\
\cos \theta \sin \phi \\
-\sin \theta \\
0
\end{bmatrix}
\quad
\uphi =
\begin{bmatrix} -\sin \phi \\ \cos \phi \\ 0 \\ 0 \end{bmatrix}
\quad
\r =
\begin{bmatrix}
r \sin \theta \cos \phi \\
r \sin \theta \sin \phi \\
r \cos \theta \\
1
\end{bmatrix}
}
$$
$$
\mat{M}_{rs} = \begin{bmatrix} \ur | \utheta | \uphi | \r \end{bmatrix}
$$
unit sphere to spheroid matrix
$$
\mat{M}_{spheroid} = \fn{diag}(a, a, b, 1)
$$
$$
\mat{N} = [\mat{M}^{-1}]^T
$$
$$
\mat{N}_{spheroid} = \fn{diag}(1/a, 1/a, 1/b, 1)
$$
spheroid to rectangular matrix
$$
\boxed{
\un =
\begin{bmatrix}
K b \sin \theta \cos \phi \\
K b \sin \theta \sin \phi \\
K a \cos \theta \\
0
\end{bmatrix}
\quad
\utheta =
\begin{bmatrix}
K a \cos \theta \cos \phi \\
K a \cos \theta \sin \phi \\
-K b \sin \theta \\
0
\end{bmatrix}
\quad
\uphi =
\begin{bmatrix}
-\sin \phi \\ \cos \phi \\ 0 \\ 0
\end{bmatrix}
\quad
\r =
\begin{bmatrix}
[K b h + a] \sin \theta \cos \phi \\
[K b h + a] \sin \theta \sin \phi \\
[K a h + b] \cos \theta \\
1
\end{bmatrix}
}
$$
$$
\mat{M}_{rs} = \begin{bmatrix} \un | \utheta | \uphi | \r \end{bmatrix}
$$
$$
\vec{n} = \mat{N}_{spheroid} \ur =
\begin{bmatrix}
\frac{1}{a} \sin \theta \cos \phi \\
\frac{1}{a} \sin \theta \sin \phi \\
\frac{1}{b} \cos \theta \\
0
\end{bmatrix}
$$
$$
\norm{\vec{n}}
= \sqrt{\frac{1}{a^2} \sin^2 \theta \cos^2 \phi + \frac{1}{a^2} \sin^2 \theta \sin^2 \phi + \frac{1}{b^2} \cos^2 \theta}
= \frac{1}{ab} \sqrt{a^2 \cos^2 \theta + b^2 \sin^2 \theta}
= \frac{1}{Kab}
$$
where $K = 1 / \sqrt{a^2 \cos^2 \theta + b^2 \sin^2 \theta}$
$$
\un = \frac{\vec{n}}{\norm{\vec{n}}} =
\begin{bmatrix}
K b \sin \theta \cos \phi \\
K b \sin \theta \sin \phi \\
K a \cos \theta \\
0
\end{bmatrix}
$$
$$
\vec{\theta} = \mat{M}_{spheroid} \utheta
\begin{bmatrix}
a \cos \theta \cos \phi \\
a \cos \theta \sin \phi \\
-b \sin \theta \\
0
\end{bmatrix}
$$
$$
\norm{\vec{\theta}}
= \sqrt{a^2 \cos^2 \theta \cos^2 \phi + a^2 \cos^2 \theta \sin^2 \phi + b^2 \sin^2 \theta}
= \sqrt{a^2 \cos^2 \theta + b^2 \sin^2 \theta}
= \frac{1}{K}
$$
$$
\utheta = \frac{\vec{\theta}}{\norm{\vec{\theta}}} =
\begin{bmatrix}
K a \cos \theta \cos \phi \\
K a \cos \theta \sin \phi \\
-K b \sin \theta \\
0
\end{bmatrix}
$$
$$
\vec{\phi} =
\mat{M}_{spheroid} \uphi
\begin{bmatrix}
-a \sin \phi \\
a \cos \phi \\
0 \\
0
\end{bmatrix}
$$
$$
\norm{\vec{\phi}} = \sqrt{a^2 \sin^2 \phi + a^2 \cos^2 \phi} = a
$$
$$
\uphi
= \frac{\vec{\phi}}{\norm{\vec{\phi}}}
= \begin{bmatrix} -\sin \phi \\ \cos \phi \\ 0 \\ 0 \end{bmatrix}
$$
$$
\r = \mat{M}_{spheroid} \r + \un h
= \begin{bmatrix}
[K b h + a] \sin \theta \cos \phi \\
[K b h + a] \sin \theta \sin \phi \\
[K a h + b] \cos \theta \\
1
\end{bmatrix}
$$
$$
\boxed{\tan \beta = \frac{1}{\sqrt{1 - e^2}} \tan \theta = \sqrt{1 - e^2} \tan \phi}
$$
$$
\tan \theta = \frac{b \sin \beta}{a \cos \beta} = \frac{b}{a} \tan \beta
$$
$$
\tan \phi = \frac{b \sin \beta - z_0}{a \cos \beta}
$$
$$
\r + t \un = \vec{z}_0
$$
$$
\begin{bmatrix} 0 \\ z_0 \end{bmatrix}
= \begin{bmatrix} a \cos \beta \\ b \sin \beta \end{bmatrix}
+ \begin{bmatrix} K b \cos \beta \\ K a \sin \beta \end{bmatrix} t
$$
$$
t = -\frac{a}{K b}
$$
$$
z_0 = b \sin \beta \bb{1 - \frac{a^2}{b^2}}
$$
$$
\tan \phi
= \frac{b \sin \beta - b \sin \beta \bb{1 - \frac{a^2}{b^2}}}{a \cos \beta}
= \frac{a}{b} \tan \beta
$$
$$
\frac{b}{a} = \sqrt{1 - e^2}
$$
References
- http://www.csun.edu/~hcmth017/master/master.html