## 3 SP-Rife Algorithm
### Defining the Frequency Deviation Factor  
The Rife algorithm is known for its high estimation accuracy when the estimated frequency is situated between two quantized frequency points. However, its accuracy diminishes as the estimated frequency approaches these quantized points. To address the limitations of the Rife algorithm and mitigate the effects of spectral leakage, the original sinusoidal signal is processed using the Rife-Vincent (I) window, and the frequency deviation factor is redefined. The Rife-Vincent (I) window function is expressed as follows [20]:  
\[h(t)=h_{\tau}(t)\frac{4^{M}(Q!)^{2}}{(2Q)!}\sin^{2M}\!\left(\frac{\pi t}{T} \right), \tag{5}\]  
where \(0\leq Q\ll N/2\) is the order of the window function, \(T=N/f_{s}\) is the sampling period, and \(h_{\tau}(t)\) is the rectangular window. Given the symmetry of the DFT for a real sequence, only the positive frequency component of the spectrum is considered in this context. The representation of the frequency spectrum for the windowed signal \(x(n)\) is given by:  
\[X(k)=(-1)^{M}(Q!)^{2}\frac{AN}{2}\frac{\sin[2\pi(k-k_{0})]}{\pi\prod\limits_{ n=-M}^{M}(k-k_{0}+n)}, \tag{6}\]  
where \(A\) is the amplitude of the sinusoidal signal, and \(k_{0}\) is the index of the quantized frequency point corresponding to the true frequency of the signal. The main frequency components of the signal can be localized by \(X(k_{1})\). However, relying on the maximum spectrum alone is not sufficient to accurately estimate the true frequency because quantization errors lead to deviations in the signal frequency. By considering both \(X(k_{1})\) and \(X(k_{2})\), the energy distribution of the signal in the vicinity of the quantized frequency point can be obtained. This distribution usually reflects the true location of the signal frequency. If the true frequency of the signal is closer to the quantization point \(k_{1}\), then \(X(k_{1})\) will be significantly larger than \(X(k_{2})\); conversely, if the true frequency is closer to the quantization point \(k_{2}\), then \(X(k_{2})\) will be relatively large. By calculating the ratio of these two spectra, it is possible to quantify this difference in energy distribution and thus estimate the degree of deviation of the signal frequency relative to the quantization point. By utilizing Equation (6), the values of \(X(k_{1})\) and \(X(k_{2})\) can be obtained:  
\[X(k_{1})=(-1)^{M}(Q!)^{2}\frac{AN}{2}\frac{\sin(2\pi\delta_{0})}{\prod\limits \limits_{n=-M}^{M}(\delta_{0}+n)}, \tag{7}\]  
and  
\[X(k_{2})=(-1)^{M}(Q!)^{2}\frac{AN}{2}\frac{\sin[2\pi(\delta_{0}-r)]}{\prod \limits_{n=-M}^{M}(\delta_{0}+n-r)}. \tag{8}\]  
When \(Q=0\), the Rife-Vincent (I) window function does not exhibit any sidelobes, resulting in minimal impact on the signal [6]. The true frequency of the signal always lies between \(k_{1}\) and \(k_{2}\), with an interval of \(r=\pm 1\) between these two indices. Additionally, it is known that the sampling frequency and the actual frequency do not have an integer relationship in reality, resulting in a deviation \(\delta_{0}\) between \(k_{1}\) and \(k_{0}\), known as the frequency deviation factor. It satisfies the relation \(0\leq\delta_{0}\leq 1/2\). Based on the relationship between the spectra, the frequency deviation factor can be determined using the ratio of \(X(k_{1})\) and \(X(k_{2})\). Therefore, the redefined frequency deviation factor can be expressed as  
\[\delta_{0}=r\frac{X(k_{1})}{X(k_{1})+X(k_{2})}. \tag{9}\]  
The \(\delta_{0}\) provides a way to quantify the frequency deviation. When \(\delta_{0}\) is close to 1, it means that the energy of the signal is mainly concentrated near \(k_{1}\), which suggests that the true frequency of the signal may be closer to the quantization frequency point \(k_{1}\), whereas, when \(\delta_{0}\) is close to 0, it means that the energy of the signal is more uniformly distributed between \(k_{1}\) and \(k_{2}\), which may suggest that the true frequency of the signal is located in between these two quantization points.