## 4 Detection and Removal of Counterfeit Signals
More details on determining whether the counterfeit signal has a long delay will be further explained in the following experiments. Step 3: Determine the time delay and amplitude of the counterfeit signal. In practice, there is usually only one counterfeit signal in any channel. In this case, besides \(\hat{A}_{0}\), the signal amplitude(s) of one single correlator or two adjacent correlators will be valid. Based on this assumption, if \(\hat{A}_{0}\), \(\hat{A}_{n}\) and \(\hat{A}_{n+1}\) are valid, where \(n=1,2,\cdots,7\), then \[\hat{\tau}_{x}=\tau_{n}+\frac{\hat{x}_{n+1}}{\hat{x}_{n}+\hat{x}_{n+1}}(\tau_{n+1 }-\tau_{n}):=\tau_{n}+\lambda_{x}(\tau_{n+1}-\tau_{n}), \tag{22}\]  
\[\hat{\tau}_{y}=\tau_{n}+\frac{\hat{y}_{n+1}}{\hat{y}_{n}+\hat{y}_{n+1}}(\tau_{n +1}-\tau_{n}):=\tau_{n}+\lambda_{y}(\tau_{n+1}-\tau_{n}). \tag{23}\]  
Generally, \(\hat{x}_{x}\
eq\hat{x}_{y}\), so we have  
\[\hat{\tau}=\tau_{n}+\frac{\lambda_{x}\hat{x}+\lambda_{y}\hat{y}}{\hat{x}+\hat{ y}}(\tau_{n+1}-\tau_{n}), \tag{24}\]  
\[\hat{A}=\sqrt{\hat{x}^{2}+\hat{y}^{2}}, \tag{25}\]  
where \(\hat{x}\) and \(\hat{y}\) are the estimated amplitudes of the I branch and the Q branch of the counterfeit signal, respectively and  
\[\hat{x}=\hat{x}_{n}+\hat{x}_{n+1}, \tag{26}\]  
\[\hat{y}=\hat{y}_{n}+\hat{y}_{n+1}. \tag{27}\]  
If only \(\hat{A}_{0}\) and \(\hat{A}_{n}\) are valid, then the estimated time delay \(\hat{\tau}\) of the counterfeit signal is equal to \(0.2n\) chips and the estimated amplitude \(\hat{A}\) is equal to \(\hat{A}_{n}\), where \(n=2,3,\cdots,7\). If only \(\hat{A}_{0}\) and \(\hat{A}_{1}\) are valid, then \(\hat{\tau}\leq 0.2\) chips. Eliminating the effect of the authentic signal on the estimated amplitude of the first correlator in the I branch, we have from Equation (26)  
\[\hat{x}=\hat{x}_{0}^{\prime}+\hat{x}_{1}, \tag{28}\]  
where \(\hat{x}_{0}^{\prime}=\hat{x}_{0}-A_{0}\). Afterwards, \(\hat{\tau}\) and \(\hat{A}\) can still be obtained using Equations (24) and (25). If the above assumptions are not valid, it is indicated that the effect of noise is significant or there is more than one counterfeit signal in the current channel. In this scenario, we can either deploy additional correlators near the correlators whose signal amplitudes are valid to calculate \(\hat{\tau}\) and \(\hat{A}\), or just skip the calculation of \(\hat{\tau}\) and \(\hat{A}\) such that the authentic signal is directly restored with the valid signal amplitudes. Since this situation is rare, it will not be detailed here. Step 4: Determine the carrier phase of the counterfeit signal. In the process of determining the time delay and amplitude of the counterfeit signal, the calculations of \(\hat{x}\) and \(\hat{y}\) are involved in different cases. It should be pointed out that the \(C/N_{0}\) of the authentic signals used in the experiments are relatively high. Correspondingly, the counterfeit signals whose power is slightly higher than that of their corresponding authentic signals also have relatively high \(C/N_{0}\). Therefore, based on \(\tan(\hat{\phi})=\hat{y}/\hat{x}\), the estimated carrier phase of the counterfeit signal can be obtained in three cases. If \(\hat{x}>0\), \(\hat{\phi}=\arctan(\hat{y}/\hat{x})\). If \(\hat{x}<0\), \(\hat{\phi}=\pi+\arctan(\hat{y}/\hat{x})\). If \(\hat{x}=0\), \(\hat{\phi}=\operatorname{sgn}(\hat{y})\pi/2\). Step 5: Remove the counterfeit signal. After detecting the time delay, amplitude and carrier phase of the counterfeit signal, the counterfeit signal is confirmed to have a short delay. The opposite counterfeit signal is added to the composite signal to restore the authentic signal. It is worth noting that the assumption of locking the authentic signal in advance can prevent us from mistakenly removing the authentic signal. Step 6: Discriminate the phase of the authentic signal. Discriminate the phase of the authentic signal with the normalized early minus late envelope function and go to the next loop.