# A GNSS-Cellular Network Hybridization Strategy for Robust Positioning
## 2 Materials and Methods
### Position-Level Hybridization Method  
This method combines position estimates from the mobile network--denoted as \((x_{\text{4G/5G}},y_{\text{4G/5G}},\)\(z_{\text{4G/5G}})\)--and from the GNSS sensor of the smartphone--denoted as \((x_{\text{GNSS}},y_{\text{GNSS}},\)\(z_{\text{GNSS}})\). These two sources of data are independent and the fusion is performed in the coordinate domain. The latitude, longitude, and altitude values from the 4G/5G mobile network are obtained using the CellTracker app. These coordinates are originally provided in a geocentric reference frame and are then transformed to the UTM projection. For this study, they were further expressed in the local east-north-up (ENU) coordinate system, and are referred to as \(x,y,\) and \(z\) throughout this manuscript. The mathematical model of this method, which is well established in the literature [30; 31], can be expressed in matrix form as follows:  
\[A\cdot x=b+v \tag{1}\]  
where the coefficient matrix \(A\) is  
\[A=\left[ \begin{array}{cccc}1&0&0\\ 0&1&0\\ 0&0&1\\ 1&0&0\\ 0&1&0\\ 0&0&1\\ \cdot&\\ \cdot&\\ 1&0&0\\ 0&1&0\\ 0&0&1\end{array} \right]_{3n\times 3} \tag{2}\]  
The vector of unknown variables (corrections) is  
\[x=\left[ \begin{array}{c}dx\\ dy\\ dz\end{array} \right]_{3x1} \tag{3}\]  
The vector of independent terms \(b\), with \(n\) observations for the \(x\), \(y\), and \(z\) coordinates, is  
\[b_{n_{x,y,z}}=\left[ \begin{array}{c}b_{1x}\\ b_{1y}\\ b_{1z}\\ \cdot\\ \cdot\\ \cdot\\ b_{nx}\\ b_{ny}\\ b_{nz}\end{array} \right]_{3 nx1} \tag{4}\]  
\(\bullet\)\(b_{nx}=x_{obs,\ n}-x_{init}\);  
\(\bullet\)\(b_{ny}=y_{obs,\ n}-y_{init}\);  
\(\bullet\)\(b_{nz}=z_{obs,\ n}-z_{init}\). The initial values of \(x_{init}\), \(y_{init}\), and \(z_{init}\) are calculated as the average of the \(n\) observed data. The vector \(v\) represents the residuals. The weighted least-squares (WLS) method allows specific weights to be assigned to each equation. The mathematical model (1) can then be written as follows:  
\[P\cdot(A\cdot x)=P\cdot(b+v) \tag{5}\]  
where \(P\) is the diagonal weight matrix of the \(n\) observations:  
\[P=\left[ \begin{array}{ccccccccc}\frac{1}{\sigma_{\text{ix}}^{2}}&0&0&0&0&0&0 &0\\ 0&\frac{1}{\sigma_{\text{iy}}^{2}}&0&0&0&0&0&0&0\\ 0&0&\frac{1}{\sigma_{\text{iz}}^{2}}&0&0&0&0&0&0\\.&.&.&.&.&.&.&.&.\\.&.&.&.&.&.&.&.\\.&.&.&.&.&.&.&.\\ 0&0&0&0&0&\frac{1}{\sigma_{\text{nz}}^{2}}&0&0\\ 0&0&0&0&0&0&\frac{1}{\sigma_{\text{hy}}^{2}}&0\\ 0&0&0&0&0&0&0&\frac{1}{\sigma_{\text{nz}}^{2}}\end{array} \right] \tag{6}\]  
Each diagonal element of \(P\) is a function of the precision value provided by the Cell Tracker app:  
\[\vartheta_{n}^{2}=\frac{\sigma_{0}^{2}}{\left(\text{\emph{accuracy of }}\text{ \emph{n observation}}\right)^{2}} \tag{7}\]  
where \(\sigma_{0}^{2}\) is a constant variance value. In Equation (7), the accuracy of each observation is obtained from the CellTracker app, which reports a set of estimated coordinates (x, y, z) together with an associated accuracy value. This value reflects the uncertainty of the position estimate for each set of GNSS or 4G data, depending on the source used. The scalar factor \(\sigma_{0}^{2}\) represents a global variance term, computed as the average of all the reported accuracy values observed throughout the experimental campaign. This global factor serves as a representative characterization of the overall noise level in the system and is used to scale the observation weights. The WLS solution for the unknown vector x is as follows:  
\[x=\left(A^{T}\cdot P\cdot A\right)^{-1}\cdot A^{T}\cdot P\cdot b \tag{8}\]  
The residual vector \(v\) vector is then given by the following:  
\[v=A\cdot x-b \tag{9}\]  
To remove outliers or blunders from the observations, a threshold is applied to the residuals:  
\[|v|>p\cdot|v_{all}| \tag{10}\]  
where,  
\(v\) is the residual from Equation (9);  
\(v_{all}\) is the mean of all residuals;  
\(p\) is a user-defined threshold parameter, e.g., \(p=2.5\).