# Ronni Grapenthin - Notes (he / him / his) email: roon.mailThis(); University of Alaska Fairbanks Geophysical Institute 2156 Koyukuk Drive Fairbanks, AK-99775

## Position Estimation With Pseudoranges

Published: 2019/03/11

This is the weby-fied version of a handout for my course on geodetic methods and modeling; might as well share it more broadly. How can we get a position estimate from signals a GPS / GNSS satellite sends?

### Introduction

A range describes the geometric distance between two points, in our case they are a satellite and a receiver. This could be inferred by (1) measuring the transit time, $\tau$, of a signal that travels from satellite to receiver at the speed of light, $c$, or (2) by calculating the Euclidean distance between known satellite and known receiver positions.

The problem with (2) is that we don't have the receiver's position and (1) depends on the receiver clock that is biased (non-atomic clock!) and the signal is affected by path delays due to ionosphere and toposphere impacts and other error sources. That's why a travel-time derived observable of distance between satellite and receiver is called pseudorange.

In the derivation below we will use pseudorange observables in a simple method to estimate receiver positions. We will not deal with all the error terms (e.g., ionosphere or troposphere) and instead assume that they can be easily integrated.

### Pseudorange Measurement Model

The pseudorange from receiver $u$ to satellite $s$, $\rho^{(s)}$, can be expressed as:

 $\rho^{(s)}=r^{(s)}+c(\delta t_{u}-\delta t^{(s)})+I+T+\epsilon$

where $r^{(s)}$ is the true range to satellite $s$, $c$ remains the speed of light, $\delta t_{u}$ is the receiver clock bias, $\delta t^{(s)}$ is clock bias of satellite $s$ and $I,T$ are ionospheric and tropospheric delays. The last term, $\epsilon$, captures unmodeled effects, such as multipath, measurement errors, etc. Note that subscripts (e.g., $u$) reflect receiver specific values, while superscripts identify individual satellites; these are not powers of $(s)$!

### Geometric Range

As mentioned in the introduction, we have two ways to express the geometric range: the transit time, $\tau$ multiplied by the speed of light, $c$, and the Euclidean distance. The former does not include the receiver position, which we would like to estimate. Thus, we use Euclidean distance here:

 $r^{(s)}=\sqrt{(x^{(s)}-x)^{2}+(y^{(s)}-y)^{2}+(z^{(s)}-z)^{2}}$

giving the Euclidean distance between a receiver at position $(x,y,z)$ and the satellite, $s$, at position $p^{(s)}=(x^{(s)},y^{(s)},z^{(s)})$. Note that here, we assume that the satellite position is given. Several levels of quality of these positions exist from broadcast (sent by satellite; about 100 cm precision) to high-precision-two-weeks-after-the-fact-satellite-positions (about 2.5 cm precision), see IGS website for more.

Note that range $r^{(s)}$ is also time dependent, which is not explicitly stated above. Obviously, the satellite moves and its position changes. But our receiver may also move (which is actually the interesting application for geophysics). Furthermore, both positions have to be given in the same coordinate system, which we will require to be earth centered earth-fixed, ECEF (details on coordinate systems may come later, for now assume that we can get the satellite position in ECEF).

### Solving Pseudorange Measurement Model for Receiver Position

Welcome to the meat of this post! Our goal is some sort of solution that gives us the receiver position. Let's have at it!

Inserting the Euclidean distance expression for $r^{(s)}$ into the pseudorange measurement model we introduced above, we get:

 $\rho^{(s)}=\sqrt{(x^{(s)}-x)^{2}+(y^{(s)}-y)^{2}+(z^{(s)}-z)^{2}}+c\delta t_{u% }-c\delta t^{(s)}+\epsilon$

where $x,y,z,\delta t_{u}$ are unknown and $\epsilon$ now captures all delays including ionosphere and troposphere delays given separately before. Unfortunately, this equation is non-linear in $x,y,z$. This prevents us from directly setting up a linear system of equations that could be easily solved with, for instance, least-squares approximations. What to do? Instead of throwing up our hands and walking away from the problem, we can try to find a linear approximation of the problem and solve that for receiver position and receiver clock error.

To achieve this, your Calc III knowledge will come in quite handy! We'll use the linear parts of a multivariate Taylor Series expansion of $\rho^{(s)}$, which assumes that we can approximate $\rho^{(s)}$ with a linear function in the vicinity of a point. For any function $f(x,y)$ that is at least differentiable once, a linear approximation about the point $(a,b)$ is given by the sum of the function at this point and its partial derivatives at that point:

 $f(x,y)=f(a,b)+\frac{\partial f}{\partial x}(a,b)(x-a)+\frac{\partial f}{% \partial y}(a,b)(y-b)$

So, if we linearize $\rho^{(s)}$ about an approximate position and expected receiver clock bias $(x_{0},y_{0},z_{0},t_{e_{0}})$ using the linear part of the multivariate Taylor Series expansion, we get:

 $\rho^{(s)}(x,y,z,t_{e})=\rho^{(s)}(x_{0},y_{0},z_{0},t_{e_{0}})+\frac{\partial% \rho^{(s)}}{\partial x}(x-x_{0})+\frac{\partial\rho^{(s)}}{\partial y}(y-y_{0}% )+\frac{\partial\rho^{(s)}}{\partial z}(z-z_{0})+\frac{\partial\rho^{(s)}}{% \partial t_{e}}(t_{e}-t_{e_{0}})+\epsilon$

Note that we substituted $\delta t_{u}$ with $t_{e}$ to avoid double deltas here. We can simplify this a bit:

 $\displaystyle\rho^{(s)}(x,y,z,t_{e})-\rho^{(s)}(x_{0},y_{0},z_{0},t_{e_{0}})$ $\displaystyle=$ $\displaystyle\frac{\partial\rho^{(s)}}{\partial x}\Delta x+\frac{\partial\rho^% {(s)}}{\partial y}\Delta y+\frac{\partial\rho^{(s)}}{\partial z}\Delta z+\frac% {\partial\rho^{(s)}}{\partial t_{e}}\Delta t_{e}+\epsilon$ $\displaystyle\Delta\rho^{(s)}$ $\displaystyle=$ $\displaystyle\left[\begin{array}[]{cccc}\frac{\partial\rho^{(s)}}{\partial x}&% \frac{\partial\rho^{(s)}}{\partial y}&\frac{\partial\rho^{(s)}}{\partial z}&% \frac{\partial\rho^{(s)}}{\partial t_{e}}\end{array}\right]\left[\begin{array}% []{c}\Delta x\\ \Delta y\\ \Delta z\\ \Delta t_{e}\end{array}\right]+\epsilon$

Remember that $\Delta\rho^{(s)}$ is the difference between the measured pseudorange and the expected geometric range between a satellite position and the apriori position. We can calculate an updated absolute position and clock bias by adding $[\Delta x,\Delta y,\Delta z,\Delta t_{e}]$ to the apriori values $[x_{0},y_{0},z_{0},t_{e_{0}}]$. We're pretty close to a solution here, but we first need to calculate the partial derivatives:

 $\left[\begin{array}[]{cccc}\frac{\partial\rho^{(s)}}{\partial x}&\frac{% \partial\rho^{(s)}}{\partial y}&\frac{\partial\rho^{(s)}}{\partial z}&\frac{% \partial\rho^{(s)}}{\partial t_{e}}\end{array}\right]$

Let's work on this for the term $\frac{\partial\rho^{(s)}}{\partial x}$. We will need the chain rule (yay, Calc I!):

 $\frac{\partial u^{n}}{\partial x}=nu^{n-1}\frac{\partial u}{\partial x}$

and we set $u$ to be the term under the square-root in the range expression for the Euclidean distance given above:

 $u=(x^{(s)}-x)^{2}+(y^{(s)}-y)^{2}+(z^{(s)}-z)^{2}$

we can write:

 $\displaystyle\frac{\partial\rho^{(s)}}{\partial x}$ $\displaystyle=$ $\displaystyle\frac{\partial\sqrt{(x^{(s)}-x)^{2}+(y^{(s)}-y)^{2}+(z^{(s)}-z)^{% 2}}}{\partial x}$ $\displaystyle=$ $\displaystyle\frac{\partial\sqrt{u}}{\partial x}$ $\displaystyle=$ $\displaystyle\frac{1}{2}u^{-\frac{1}{2}}\frac{\partial u}{\partial x}$ $\displaystyle=$ $\displaystyle\frac{1}{2u^{\frac{1}{2}}}\frac{\partial[(x^{(s)}-x)^{2}+(y^{(s)}% -y)^{2}+(z^{(s)}-z)^{2}]}{\partial x}$ $\displaystyle=$ $\displaystyle\frac{1}{2u^{\frac{1}{2}}}\frac{\partial[(x^{(s)}-x)^{2}]}{% \partial x}$ $\displaystyle=$ $\displaystyle\frac{2(x^{(s)}-x)}{2u^{\frac{1}{2}}}(-1)$ $\displaystyle=$ $\displaystyle\frac{x-x^{(s)}}{\rho^{(s)}}$

Doing this for all the partial derivatives at the apriori position gives us:

 $\displaystyle\frac{\partial\rho^{(s)}}{\partial x}$ $\displaystyle=$ $\displaystyle\frac{x_{0}-x^{(s)}}{\rho_{0}^{(s)}}$ $\displaystyle\frac{\partial\rho^{(s)}}{\partial y}$ $\displaystyle=$ $\displaystyle\frac{y_{0}-y^{(s)}}{\rho_{0}^{(s)}}$ $\displaystyle\frac{\partial\rho^{(s)}}{\partial z}$ $\displaystyle=$ $\displaystyle\frac{z_{0}-z^{(s)}}{\rho_{0}^{(s)}}$ $\displaystyle\frac{\partial\rho^{(s)}}{\partial t_{e}}$ $\displaystyle=$ $\displaystyle c$

The result for the partial derivative with respect to the clock error follows from earlier expressions of $\delta t_{u}$. Note that $\rho_{0}^{(s)}$ is the geometric range from the apriori position to satellite $s$, which can be calculated without needing the precise position. Any model corrections that could be applied (e.g., troposphere, ...) could go in there, too. With these expressions for the partial derivatives, we can rewrite the equation for $\Delta\rho^{(s)}$ as:

 $\displaystyle\Delta\rho^{(s)}$ $\displaystyle=$ $\displaystyle\left[\begin{array}[]{cccc}\frac{x_{0}-x^{(s)}}{\rho_{0}^{(s)}}&% \frac{y_{0}-y^{(s)}}{\rho_{0}^{(s)}}&\frac{z_{0}-z^{(s)}}{\rho_{0}^{(s)}}&c% \end{array}\right]\left[\begin{array}[]{c}\Delta x\\ \Delta y\\ \Delta z\\ \Delta t_{e}\end{array}\right]+\epsilon$

Assuming that we have $n$ satellites in view, each of which giving us a pseudorange measurement $\rho^{(1)},\dots,\rho^{(n)}$, we can now set up a linear system of equations:

 $\left[\begin{array}[]{c}\Delta\rho^{(1)}\\ \Delta\rho^{(2)}\\ \vdots\\ \Delta\rho^{(n)}\end{array}\right]=\left[\begin{array}[]{cccc}\frac{x_{0}-x^{(% 1)}}{\rho_{0}^{(1)}}&\frac{y_{0}-y^{(1)}}{\rho_{0}^{(1)}}&\frac{z_{0}-z^{(1)}}% {\rho_{0}^{(1)}}&c\\ \frac{x_{0}-x^{(2)}}{\rho_{0}^{(2)}}&\frac{y_{0}-y^{(2)}}{\rho_{0}^{(2)}}&% \frac{z_{0}-z^{(2)}}{\rho_{0}^{(2)}}&c\\ \vdots&\vdots&\vdots&\vdots\\ \frac{x_{0}-x^{(n)}}{\rho_{0}^{(n)}}&\frac{y_{0}-y^{(n)}}{\rho_{0}^{(n)}}&% \frac{z_{0}-z^{(n)}}{\rho_{0}^{(n)}}&c\end{array}\right]\left[\begin{array}[]{% c}\Delta x\\ \Delta y\\ \Delta z\\ \Delta t_{e}\end{array}\right]+\epsilon$

### Solving the System

This matrix equation is of the form $Gm=d$ where $G$ is a matrix containing the partial derivatives, $d$ is a vector with the pseudorange differences, and $m$ is the vector with the unknowns; specifically the receiver position and clock error. We can solve this with least squares techniques to minimize the sum of squared residuals, for instance, using the normal equations:

 $m=(G^{T}G)^{-1}G^{T}d$

We can also introduce a weight matrix $W$ to, for instance, put less emphasis on satellites at low elevation angles (I leave it up to you to define reasonable relationships here):

 $m=(G^{T}WG)^{-1}G^{T}Wd$

Once we have a solution $m=[\Delta x,\Delta y,\Delta z,\Delta t_{e}]$, we can add update the apriori values:

 $\left[\begin{array}[]{c}x_{new}\\ y_{new}\\ z_{new}\\ t_{e_{new}}\\ \end{array}\right]=\left[\begin{array}[]{c}x_{0}\\ y_{0}\\ z_{0}\\ t_{e_{0}}\\ \end{array}\right]+\left[\begin{array}[]{c}\Delta x\\ \Delta y\\ \Delta z\\ \Delta t_{e}\\ \end{array}\right]$

and iterate until improvements are small.

### That's it!

You can now do what your phone does. If you wish, practice it here in a lab that's part of my class. Use any programming language you like.

The position quality you're getting here isn't fantastic, but good enough to keep you on the road. In science we're usually using dual frequency GPS and track the phase of the signal, which allows for much higher precision. More on that another time, I hope.

rg <at> nmt <dot> edu | Created: 2019/03/11 | Last modified: March 12 2019 15:14.