# Optimal Particle Filter Weight for Bayesian Direct Position Estimation in a GNSS Receiver
## 3 Particle Filter
The approximation of the PDF in (6) is based on a set of support points \(\{\mathbf{x}_{k}^{i},i=1,...,N_{s}\}\) with associated weights \(w_{k}^{i}\), where the weights are normalized such that \(\sum_{i=1}^{N_{k}}w_{k}^{i}=1\). The \(\delta(\cdot)\) in (6) denotes the Dirac delta measure. It is a crucial step of the particle filter to obtain the current epoch weight \(w_{k}^{i}\), which depends proportionally on the previous epoch's weight \(w_{k-1}^{i}\) which is propagated in time using by \(p(\mathbf{x}_{k}^{i}|\mathbf{x}_{k-1}^{i})\) through (2), updated with new information by \(p(\mathbf{z}_{k}|\mathbf{x}_{k}^{i})\) using the relation in (5) and normalized by the the importance density \(q(\mathbf{x}_{k}^{i}|\mathbf{x}_{k-1}^{i},\mathbf{z}_{k})\). The importance density \(q(\cdot)\) defines the probability distribution of the support points, which is chosen in the presented implementation to be Gaussian distributed with an approximate mean of the truth in the very first step. The choice of \(q(\cdot)\) is an important design step of a particle filter and one common approach is to choose the prior PDF such as  
\[q(\mathbf{x}_{k}|\mathbf{x}_{k-1}^{i},\mathbf{z}_{k})=p(\mathbf{x}_{k}| \mathbf{x}_{k-1}^{i}), \tag{8}\]  
which leads to the simple weight update equation  
\[w_{k}^{i}\propto w_{k-1}^{i}p(\mathbf{z}_{k}|\mathbf{x}_{k}^{i}). \tag{9}\]  
The realization of a particle filter using (9) is known as a Bootstrap filter. The concept of a Bootstrap filter is also implemented within this work. To be able to update the weights optimally, a probabilistic measurement model for \(p(\mathbf{z}_{k}|\mathbf{x}_{k}^{i})\) in (9) with dependency on the prior state must be available. In the proposed approach, the state vector \(\mathbf{x}_{k}\) at current epoch \(k\) is an 8-element vector containing the GNSS receiver position, velocity and time, where the position and velocity take three elements each and time two elements refer to the receiver clock error and receiver clock drift. The measurements \(\mathbf{z}_{k}\) at current epoch \(k\) refer to a vector containing the raw GNSS samples. In order to update the particle weight, BDPE directly maps the PVT at the particles to the raw signal samples, which contains a superposition of all GNSS signals. Thus, a probabilistic description of the samples dependent on multiple GNSS signals must be available. Such a probabilistic model exists in literature (see, e.g., (5.9) of [27]) for a single GNSS signal and is given as \[\mathbf{x}_{k}=\mathbf{f}_{k}(\mathbf{x}_{k-1},\mathbf{v}_{k-1}), \tag{2}\]0  
where the vector \(\mathbf{s}\in\mathbb{C}^{L}\) contains all signal samples \(s_{\mu},\mu\in\{1,...,L\}\), which depend on the signal model parameters, the real valued signal amplitude \(A\in\mathbb{R}^{+}\), the time delay \(\tau\in\mathbb{R}\), the Doppler frequency \(\omega\in\mathbb{R}\), the uniformly distributed carrier phase \(\phi\in[0,2\pi[\) and \(i\) the imaginary number. The term \(c(t_{\mu}-\tau)\in[-1,1]\) refers to the PRN code and the term \(\exp\{i\omega t_{\mu}-i\phi\}\) to the signal carrier. The parameter \(t_{\mu}\in\mathbb{R}\) defines the time at sample index \(\mu\) and depends on the sampling frequency \(f_{s}\in\mathbb{R}\) such as \(t_{\mu}=\mu/f_{s}\). The probability distribution \(p(\mathbf{z}_{k}|\mathbf{x}_{k}^{i})\) in the weight update Equation (9) can be related to the sample distribution in (10), where \(\mathbf{z}_{k}\) equals the measured sample vector such as \(\mathbf{s}=\mathbf{z}_{k}\), where \(t_{\mu=1}\) corresponds to the time of the first sample in epoch \(k\) and \(t_{\mu=L}\) to the time of the last sample in epoch \(k\). The parameters \(A,\tau,\omega,\phi\) for a single replica can directly be related to the PVT state \(\mathbf{z}_{k}\), respectively, to the state of each PVT particle. The state \(\mathbf{z}_{k}\) is defined as  
\[\mathbf{z}_{k}= \begin{bmatrix}\mathbf{r}_{xx}\\ \mathbf{v}_{rx}\\ \mathbf{t}_{rx}\end{bmatrix} = \begin{bmatrix}[x,y,z]^{T}\\ [v_{x},v_{y},v_{z}]^{T}\\ [t_{rxClkErr},t_{rxClkDrift}]^{T}\end{bmatrix}