## 2 Positioning Model and Residual Analysis  
### Observation Model  
Although many smartphones are currently capable of receiving dual-frequency or multi-frequency signals from the GNSS, when applied in real-world scenarios, limitations in the mobile terminal hardware or interferences from the surrounding environment can lead to situations where they are unable to continuously and completely receive all multi-frequency signals from the satellites. Consequently, this results in a smaller number of satellites with dual-frequency GNSS signals in each epoch, which is not conducive to positioning calculations. Furthermore, the stochastic model of observations examined in this study is applicable to both single-frequency and multi-frequency signals, with no fundamental distinction. Therefore, this paper takes single-frequency GNSS observational information as an example to study. In GNSS pseudorange differential relative positioning, DD observations are utilized to formulate an observation equation. Notably, the clock errors of the receiver and satellite in the observations are entirely negated through the inter-satellite and inter-station difference processes. Given that a Global Positioning System (GPS) and Beidou Navigation Satellite System (BDS) are part of the code division multiple access (CDMA) signal system, each satellite within the system shares the same frequency, and the hardware delay of the receiver can be regarded akin to the receiver clock error, which is wholly eliminated during the inter-satellite difference process. Consequently, the fundamental observation equation model of GPS/BDS pseudorange relative positioning is expressed as  
\[\
abla\Delta P=\
abla\Delta\rho+\
abla\Delta I+\
abla\Delta T+\
abla\Delta M+ \
abla\Delta O+\
abla\Delta\varepsilon \tag{1}\]  
where \(\
abla\Delta\) denotes the DD operator, \(P\) is the pseudorange observation, \(\rho\) is the geometric distance between the satellite and the receiver, \(I\) and \(T\) are the ionospheric delay and tropospheric delay, respectively, \(M\) and \(O\) are the multipath and satellite orbit errors, respectively, and \(\varepsilon\) is the pseudorange observational noise. To facilitate equation solving, the approximate coordinates of the smartphone are assumed to be \((x^{\circ},\ y^{\circ},\ z^{\circ})\), and the double-difference geometric distance \(\rho\) is linearized using Taylor expansion. The accuracy of the linearization process primarily depends on two factors: the error introduced by neglecting higher-order terms and the error due to the chosen approximation point deviating from the actual point. The former error is significantly smaller than the errors in pseudorange measurements caused by multipath effects and observation noise, and its impact on positioning results is minimal and can be neglected. To address the latter, the influence of this error is progressively reduced through multiple iterations during the computation, thereby enhancing the precision of linearization. After linearization, the error equation can be expressed as  
\[V=BX-L \tag{2}\]where \(X=[\delta x\ \delta y\ \delta z]\) represents the correction of the smartphone's approximate coordinates, \(V\) denotes the correction of double-difference observations, and \(B\) is the corresponding coefficient matrix. \(L\) can be expressed as the following:  
\[L=\
abla\Delta P-\
abla\Delta\rho^{0}-\
abla\Delta I-\
abla\Delta T-\
abla\Delta M -\
abla\Delta O-\
abla\Delta\epsilon \tag{3}\]  
where \(\rho^{0}\) is the geometric distance between the satellite and the receiver, calculated based on the smartphone's approximate coordinates. In short-distance relative positioning, atmospheric and orbit errors can be neglected. If the weight matrix of the observations is \(W\), representing the stochastic model of the observations, then according to the least squares principle, \(X\) can be calculated as  
\[X=\left(B^{T}WB\right)^{-1}B^{T}WL \tag{4}\]  
\[W=Q^{-1} \tag{5}\]  
\[Q=\frac{1}{\sigma_{0}^{2}}