# Optimal Particle Filter Weight for Bayesian Direct Position Estimation in a GNSS Receiver
## 4 Derivation of the Optimal Particle Weight for Multiple GNSS Signals
 \tag{21}\]  
Insert Equation (21) in Equation (17), consider that the sum of the squared PRN code leads to \(\sum_{\mu=1}^{L}|c(t_{\mu}-\tau_{2})|^{2}=L\) and realigning the terms to integrate out \(\phi_{1}\) and \(\phi_{2}\) leads to \[\mathbf{q_{6}} = [A_{1},\tau_{1},\omega_{1},A_{2},\tau_{2},\omega_{2}] \tag{22}\] \[p(\mathbf{s}|\mathbf{q_{6}}) = \frac{1}{(2\pi)^{L}}\exp\left\{-\frac{1}{2}\sum_{\mu=1}^{L}\left|s _{\mu}\right|^{2}\right\}\!,\] \[\frac{1}{(2\pi)}\int_{\phi_{1}=0}^{2\pi}\exp\left\{-\frac{LA_{1}^ {2}}{2}\right\}\exp\left\{A_{1}\sum_{\mu=1}^{L}Re(\overline{s_{\mu}}c_{1}(t_{ \mu}-\tau_{1})\exp\{i\omega_{1}t_{\mu}-i\phi_{1}\}\right\}\!d\phi_{1}\] \[\frac{1}{(2\pi)}\int_{\phi_{2}=0}^{2\pi}\exp\left\{-\frac{LA_{2}^ {2}}{2}\right\}\exp\left\{A_{2}\sum_{\mu=1}^{L}Re(\overline{s_{\mu}}c_{2}(t_{ \mu}-\tau_{2})\exp\{i\omega_{2}t_{\mu}-i\phi_{2}\}\right\}\!d\phi_{2}\] \[= \frac{1}{(2\pi)^{L}}\exp\left\{-\frac{1}{2}\sum_{\mu=1}^{L} \left|s_{\mu}\right|^{2}\right\}\] \[\exp\left\{-\frac{LA_{1}^{2}}{2}\right\}\!I_{0}(A_{1}|P_{1}(\tau _{1},\omega_{1})_{1}|\sqrt{L})\] \[\exp\left\{-\frac{LA_{2}^{2}}{2}\right\}\!I_{0}(A_{2}|P_{2}(\tau _{2},\omega_{2})_{2}|\sqrt{L}).\]  
It can be shown in Equation (24) that the extension to multiple GNSS follows the same structure as shown in Equation (14) for a single GNSS signal, if the orthogonal cross correlation terms are neglected as shown in Equation (20). Solving an integral of type \(\int_{0}^{\infty}\exp\{-\frac{x^{2}}{c}\}I_{0}(xp)dx\) was performed with the help of Wolfram Mathematica (Version 11.3, Wolfram Research Inc., Champaign, IL, USA) [29], which helps to integrate out the amplitude as  
\[p(\mathbf{s}|\tau_{1},\omega_{1},\tau_{2},\omega_{2}) = \frac{1}{(2\pi)^{L}}\exp\left\{-\frac{1}{2}\sum_{\mu=1}^{L}|s_{ \mu}|^{2}\right\}\] \[\int_{A_{1}=0}^{\infty}\exp\left\{-\frac{LA_{1}^{2}}{2}\right\}\! I_{0}(A_{1}|P_{1}(\tau_{1},\omega_{1})_{1}|\sqrt{L})dA_{1}\] \[\int_{A_{2}=0}^{\infty}\exp\left\{-\frac{LA_{2}^{2}}{2}\right\}\! I_{0}(A_{2}|P_{2}(\tau_{2},\omega_{2})_{2}|\sqrt{L})dA_{2}\] \[p(\mathbf{s}|\mathbf{q_{6}}) = \frac{1}{(2\pi)^{L}}\exp\left\{-\frac{1}{2}\sum_{\mu=1}^{L}\left|s _{\mu}\right|^{2}\right\}\!,\]0 \[p(\mathbf{s}|\mathbf{q_{6}}) = \frac{1}{(2\pi)^{L}}\exp\left\{-\frac{1}{2}\sum_{\mu=1}^{L}\left|s _{\mu}\right|^{2}\right\}\!,\]1 \[p(\mathbf{s}|\mathbf{q_{6}}) = \frac{1}{(2\pi)^{L}}\exp\left\{-\frac{1}{2}\sum_{\mu=1}^{L}\left|s _{\mu}\right|^{2}\right\}\!,\]2  
With the assumption of using Gaussian distributed complex valued samples \(\mathbf{s}_{\mu}\) whose real and imaginary parts are each of variance one and zero mean, the sum over the absolute squared samples approximates to \(L\approx\frac{1}{2}\sum_{\mu=1}^{L}|s_{\mu}|^{2}\). This approximation can be made if the GNSS signal amplitude is significantly smaller than the noise. This is generally the case for GNSS signals when considering receivers operated on the ground [1]. With this approximation, Equation (26) can be rewritten for \(N\) GNSS signals as \[p(\mathbf{s}|\mathbf{q_{6}}) = \frac{1}{(2\pi)^{L}}\exp\left\{-\frac{1}{2}\sum_{\mu=1}^{L}\left|s _{\mu}\right|^{2}\right\}\!,\]3  
Equation (27) defines the probability function \(p(\mathbf{z}_{k}|\mathbf{x}_{k}^{i})\) for an arbitrary number \(N\) GNSS signals in order to obtain \(w_{k}^{i}\) in Equation (9). Note that the code-phase and Dopplers changed now to vectors \(\boldsymbol{\tau}\in\mathbb{R}^{N}\) and \(\boldsymbol{\omega}\in\mathbb{R}^{N}\). However, with this equation, the weight can not be evaluated directly due to finite precision effects. In particular, the terms \(\exp\left\{\frac{|P_{n}(\tau_{n},\omega_{n})|^{2}}{4}\right\}\) and \(I_{0}\left(\frac{|P_{n}(\tau_{n},\omega_{n})|^{2}}{4}\right)\) use a typically 'large' correlation value \(P\), which causes a numerical problem. The common maximum value that can be stored on 64-bit platforms is a double precision floating point value (not considering dedicated floating point libraries). The maximum value is limited to 1.7E \(\pm\) 308 (15 digits) [30].