## 4 Time Differenced Filter Algorithm
### State Equation  
If the constant velocity or acceleration model is used, it would be difficult for the equations of motion to accommodate sudden changes in the user's movement, which would result in navigation solutions significantly deviated from the truth. Meanwhile, considering the characteristics of high precision, but frequent cycle slips for raw carrier phase observations from Xiaomi Mi 8, a better way is to estimate the IEPV, which is more capable of representing the pedestrian motion and more accurate than Doppler-derived velocity. Clearly, the calculation of IEPV is very important in this time differenced filter algorithm. Its primary intention is to make full use of the characteristics that the ionosphere and troposphere delays vary slowly within a short time (1 s), which is in fact negligible [31], and thus high-precision IEPV could be estimated with the use of TDCP measurements between epochs. However, the carrier phase noise of Xiaomi Mi 8 is about 2 cm as shown above, which is larger than that of survey-grade receivers. If one still uses the dual-frequency ionosphere-free combinations, the noise of the combined phase observations is amplified to about three times that of the single frequency phase noise, and will be larger than the variation of ionosphere and troposphere between epochs, reducing the accuracy of IEPV. Secondly, as illustrated in Figure 2, the carrier phase cycle slips may not simultaneously occur in L1/E1 and L5/E5 measurements. If the ionosphere-free combination carrier phase measurements are still used, the calculation success rate of IEPV is inevitably affected. Evidently, if single frequency carrier phase observations are used instead of dual-frequency ionospheric-free combinations, more usable TDCP measurements are derived and the calculation success rate of IEPV is higher. According to the literature [32; 33], the error in the signal path caused by the broadcast ephemeris orbit and clock varies slowly. In the case of high sampling rate, the time differenced phase observation from two successive epochs has most of the GNSS orbit and clock errors eliminated. The single frequency TDCP measurement equation can be formed as:  
\[\Delta L^{j}=L^{j}(t_{i})-L^{j}(t_{i-1})=\Delta\rho-c\cdot\Delta d^{s}+c\cdot \Delta dt_{r}+\Delta\varepsilon_{L^{j}} \tag{1}\]  
where, \(\Delta\) is the differencing operator, such as \(\Delta\rho=\rho(t_{i})-\rho(t_{i-1})\), \(L\) is the carrier phase observation, the superscript \(j\) is the frequency label for Xiaomi Mi 8, \(j=L1/E1,L5/E5\), \(c\) is the speed of light in vacuum, \(dt^{s}\) and \(dt_{r}\) are the GNSS satellite and receiver clock offsets, respectively, and \(\varepsilon_{L^{j}}\) is the carrier phase observation noise, which includes multipath errors. For GPS-only observations, assume the receiver position and clock offset at \(t_{i-1}\) are \(\mathbf{X}_{t_{i-1}}=\left(x_{t_{i-1}},y_{t_{i-1}},z_{t_{i-1}},dt_{r,t_{i-1}}^ {GPS}\right)^{T}\) and the variation from \(t_{i-1}\) to \(t_{i}\) is \(\Delta\mathbf{X}_{t_{i-1},t_{i}}=\left(\Delta x,\Delta y,\Delta z,\Delta dt_{ r}\right)^{T}\). After the substitute of \(\Delta\mathbf{X}_{t_{i-1},t_{i}}\) into Equation (1) and the linearization thereafter, a linear model about \(\Delta\mathbf{X}_{t_{i-1},t_{i}}\) is obtained. It is now possible to solve \(\Delta\mathbf{X}_{t_{i-1},t_{i}}\) with the standard least squares method:  
\[\Delta\mathbf{X}_{t_{i-1},t_{i}}=\left(\mathbf{H}^{T}\mathbf{P}\mathbf{H} \right)^{-1}\mathbf{H}^{T}\mathbf{P}\mathbf{I} \tag{2}\]  
where \(\mathbf{H}\) is the time differenced observation design matrix, \(\mathbf{I}\) is the residuals of the observation matrix, and \(\mathbf{P}\) is the weight matrix. As discussed in Section 3.2, a C/N0-dependent weighting strategy is applied to determine \(\mathbf{P}\).