## 3 SP-Rife Algorithm
### Phase Angle Interpolation and Criterion  
The phase angle varies within the range of 0 to \(\pi\), offering greater stability compared to the amplitude. Therefore, in the SP-Rife algorithm, frequency estimation is conducted through phase angle interpolation.  
The spectrum of a sinusoidal signal can be further expressed in terms of phase and amplitude as follows:  
\[X(k)=A(k)\cos[\varphi(k)]+jA(k)\sin[\varphi(k)]=\frac{a\sin[2\pi(k-k_{0})]}{2 \sin[2\pi(k-k_{0})/N]}e^{j[\theta_{0}-\pi(k-k_{0})]}. \tag{10}\]  
\[A(k)=\frac{a\sin[2\pi(k-k_{0})]}{2\sin[2\pi(k-k_{0})/N]} \tag{11}\]  
\[\varphi(k)=\theta_{0}-\pi(k-k_{0}) \tag{12}\]  
From the above equations, it can be concluded that the magnitude of the phase angle corresponding to the spectrum is determined by \(A(k)\) and \(\varphi(k)\). Given \(0<|k-k_{0}|<0.5\), when \(k_{1}\) corresponds to the quantized frequency point with the maximum spectrum value,\(0<\pi(k_{1}-k_{0})<\pi\). It can be concluded that \(A(k_{1})\) and \(A(k_{1}+1)\) are positive, while \(A(k_{1}-1)\) is negative. As shown in Figure 1, the denominator of \(A(k)\) is always positive when \(k-k_{0}>0\). When \(k=k_{1}+1\), both the denominator and numerator of \(A(k)\) are positive, so \(A(k_{1}+1)\) is positive. When \(k=k_{1}-1\), the numerator of \(A(k)\) is positive and the denominator is negative, so \(A(k_{1}-1)\) is negative.  
Assuming \(\varphi(k_{1})\) is in the first quadrant, it can be derived that \(\cos[\varphi(k_{1})]>0\), and both \(\varphi(k_{1}-1)\) and \(\varphi(k_{1}+1)\) are in the third quadrant. From Equation (10), the following is obtained:  
\[\begin{cases}A(k_{1})\cos[\varphi(k_{1})]>0&A(k_{1})\sin[\varphi(k_{1})]>0\\ A(k_{1}+1)\cos[\varphi(k_{1}+1)]<0&A(k_{1}+1)\sin[\varphi(k_{1}+1)]<0\\ A(k_{1}-1)\cos[\varphi(k_{1}-1)]>0&A(k_{1}-1)\sin[\varphi(k_{1}-1)]>0\end{cases}. \tag{13}\]  
From the above analysis, it can be inferred that the phase angles corresponding to \(k_{1}\) and \(k_{1}-1\) are situated in the first quadrant, while the phase angle corresponding to \(k_{1}+1\) is in the third quadrant. Given the substantial phase angle variation at \(k_{1}+1\), interpolation correction will be applied between \(k_{1}\) and \(k_{1}+1\). The direction of frequency deviation correction is also determined based on the extent of the phase angle variation. Similarly, for other quadrant conditions of \(\varphi(k_{1})\), this analysis allows for analogous conclusions.  
Combining Equation (9), the frequency deviation factor \(\delta_{1}\) based on the phase angle can be obtained:  
\[\delta_{1}=r_{1}\frac{|angle[X(k_{1})]|}{|angle[X(k_{1})]|+|angle[X(k_{1}+r_ {1})]|}, \tag{14}\]  
where \(angle[\cdot]\) is the phase angle function, and \(r_{1}\) represents the correction direction. The determination of the correction direction is based on the following conditions:  
\[r_{1}=\begin{cases}1,&|angle[X(k_{1}+1)]|\geq|angle[X(k_{1}-1)]|\\ -1,&|angle[X(k_{1}+1)]|\leq|angle[X(k_{1}-1)]|\end{cases}. \tag{15}\]  
If \(r_{1}=1\), the true frequency point is to the right of the maximum spectral position \(k_{1}\). If \(r_{1}=-1\), the true frequency point is to the left of \(k_{1}\).  
After frequency spectrum refinement and phase angle interpolation, the corrected frequency is calculated using Equation (16).  
\[\hat{f}_{0}=\frac{(k_{1}+r_{1}\delta_{1})f_{\rm s}}{N}, \tag{16}\]  
where \(f_{\rm s}\) is the signal sampling frequency.  
Figure 1: The process of changing the symbol of \(A(k)\).