# Optimal Particle Filter Weight for Bayesian Direct Position Estimation in a GNSS Receiver
## 4 Derivation of the Optimal Particle Weight for Multiple GNSS Signals  
Basically, the goal of the derivation is to retrive a formulation for an optimal particle weight in dependence of an abitrary number of used GNSS signals dependent on the code phase \(\tau\) and Doppler \(\omega\) only. Thus, the following equations show the extension of the probabilistic model from single to multiple GNSS signals in Equation (17) with dependency on \(A\), \(\tau\), \(\omega\), \(\phi\), in Equation (24) with dependency on \(A\), \(\tau\), \(\omega\) and in Equation (27) with dependency on \(\tau\), \(\omega\). Under the assumption that the carrier phase is uniformly distributed over \(0\) and \(2\pi\), it can be integrated out as shown in [27] to  
\[ \begin{array}{rcl}p(\mathbf{s}|A,\tau,\omega)&=&\frac{1}{(2\pi)!}\int_{\phi=0}^{2\pi}\exp\Big{\{}-\frac{1}{2}\sum_{\mu=1}^{L}|s_{\mu}-Ac(t_{ \mu}-\tau)\exp\{i\omega t_{\mu}-i\phi\}|^{2}\Big{\}}d\phi\\ &=&\frac{1}{(2\pi)!}\exp\Big{\{}-\frac{1}{2}\sum_{\mu=1}^{L}|s_{\mu}|^{2}\Big{\}} \exp\Big{\{}-\frac{LA^{2}}{2}\Big{\}}I_{0}(A|P(\tau,\omega)|\sqrt{L})\end{array}  \tag{14}\]  
with the definition of the correlator value \(P_{n}(\tau,\omega)\) as  
\[P_{n}(\tau,\omega)=\frac{1}{\sqrt{L}}\sum_{\mu=1}^{L}\bar{s}_{\mu}c_{n}(t_{ \mu}-\tau)\exp\{-i\omega t_{\mu}\}, \tag{15}\]  
where the correlation value \(P_{n}(\tau,\omega)\) is taken from the multi-correlation maps as shown in Figure 1 and \(I_{0}\) referes to the Bessel function of the first kind and order zero. A similar Equation for joint detection of weak GNSS signals can be found in [18]. In order to extend the model to multiple GNSS signals, let's do this in the first step for two signals and find later a mathematical rule to extend it to multiple signals. The basic model for two signals is defined as  
\[\mathbf{q_{s}} = [A_{1},\tau_{1},\omega_{1},\phi_{1},A_{2},\tau_{2},\omega_{2}, \phi_{2}], \tag{16}\] \[p(\mathbf{s}|\mathbf{q_{s}}) = \frac{1}{(2\pi)!}\exp\left\{\underbrace{-\frac{1}{2}\sum_{\mu=1} ^{L}\big{|}s_{\mu}-\big{[}\frac{r_{1}}{A_{1}c_{1}(t_{\mu}-\tau_{1})\exp\{i \omega_{1}t_{\mu}-i\phi_{1}\}}+\frac{r_{2}}{A_{2}c_{2}(t_{\mu}-\tau_{2})\exp\{ i\omega_{2}t_{\mu}-i\phi\}}\big{]}\big{|}^{2}}_{m}\right\}, \tag{17}\]  
and with the definition of \(|z|=\sqrt{z\bar{z}}\), \(|z|^{2}=z\bar{z}\) and the redefinition of the replica signals \(r_{1}\) and \(r_{2}\), \(m\) can be expanded to  
\[m = -\frac{1}{2}\sum_{\mu=1}^{L}\Big{(}s_{\mu}\overline{s_{\mu}}-s_{ \mu}\overline{[r_{1}+r_{2}]}-\overline{s_{\mu}}[r_{1}+r_{2}]+[r_{1}+r_{2}] \overline{[r_{1}+r_{2}]}\Big{)} \tag{18}\] \[= -\frac{1}{2}\sum_{\mu=1}^{L}\Big{(}s_{\mu}\overline{s_{\mu}}-s_{ \mu}\overline{r_{1}}-s_{\mu}\overline{r_{2}}-\overline{s_{\mu}}r_{1}-\overline {s_{\mu}}r_{2}+r_{1}\overline{r_{1}}+r_{2}\overline{r_{1}}+r_{1}\overline{r_{ 2}}+r_{2}\overline{r_{2}}\Big{)}\] (19) \[= -\frac{1}{2}\sum_{\mu=1}^{L}\Big{(}|s_{\mu}|^{2}+|r_{1}|^{2}-2 Re( \overline{s_{\mu}}r_{1})+\overbrace{|r_{2}|^{2}-2 Re(\overline{s_{\mu}}r_{2})+ \overbrace{\text{cross correlation term}\approx 0}}^{\text{new terms due to 2 nd signal}}. \tag{20}\]  
With \(|r_{n}|^{2}=A_{n}^{2}|c(t_{\mu}-\tau_{n})|^{2}\) and neglecting the cross-correlation terms leads to  
\[ \begin{array}{rcl}m&=&-\frac{1}{2}\sum_{\mu=1}^{L}\Big{(}|s_{\mu}|^{2}+A_{ 1}^{2}|c_{1}(t_{\mu}-\tau_{1})|^{2}-2 Re(\overline{s_{\mu}}A_{1}c_{1}(t_{\mu}- \tau_{1})\exp\{i\omega_{1}t_{\mu}-i\phi_{1}\})\\ &&\qquad\qquad\qquad+A_{2}^{2}|c_{2}(t_{\mu}-\tau_{2})|^{2}-2 Re(\overline{s_{ \mu}}A_{2}c_{2}(t_{\mu}-\tau_{2})\exp\{i\omega_{2}t_{\mu}-i\phi_{2}\})\Big{)} \Big{)}.\end{array}