# An Improved CZT Algorithm for High-Precision Frequency Estimation
## 3 Improved CZT Algorithm
### Design of Bias Correction Factor \(\mu\) for Frequency Bias Estimation  
Assuming that the true frequency to be estimated \(f_{c}\) can be expressed as:  
\[f_{c}=\big{(}k_{p}-q\big{)}\frac{f_{s}}{N}+(k_{m}+\delta)\frac{2 qf_{s}}{NM} \tag{11}\]  
where \(2 qf_{s}/N\) is the frequency bandwidth, \(k_{m}\) is the frequency index corresponding to the maximum amplitude of the CZT spectrum, and \(\delta\in[-0.5,\,0.5]\) is the bias between the true frequency and the frequency estimate obtained by the CZT algorithm. In order to accurately estimate the frequency bias \(\delta\), the CZT spectrum is analyzed, and the bias correction factor \(\mu\) is constructed based on the maximum point \(X_{\text{CZT}}(k_{m})\) and its two adjacent spectral points, \(X_{\text{CZT}}(k_{m}-1)\) and \(X_{\text{CZT}}(k_{m}+1)\), as follows.  
Following the principle of the CZT algorithm, the maximum point \(X_{\text{CZT}}(k_{m})\) of the CZT spectrum can be expressed as:  
\[X_{\text{CZT}}(k_{m})=a_{0}\exp(j2\pi\varphi_{0})\times\exp\bigg{(}j2\pi \bigg{(}\frac{q\delta(N-1)}{MN}\bigg{)}\bigg{)}\times\frac{\sin\bigg{(}\pi \frac{2q\delta}{M}\bigg{)}}{\sin\bigg{(}\pi\frac{2q\delta}{MN}\bigg{)}} \tag{12}\]  
The left-hand point \(X_{\text{CZT}}(k_{m}-1)\) and the right-hand point \(X_{\text{CZT}}(k_{m}+1)\) of the maximum point \(X_{\text{CZT}}(k_{m})\) can be expressed as:  
\[X_{\text{CZT}}(k_{m}-1)=a_{0}\exp(j2\pi\varphi_{0})\times\exp\bigg{(}j2\pi \bigg{(}\frac{q(\delta+1)(N-1)}{MN}\bigg{)}\bigg{)}\times\frac{\sin\bigg{(}\pi \frac{2q(\delta+1)}{M}\bigg{)}}{\sin\bigg{(}\pi\frac{2q(\delta+1)}{MN}\bigg{)}} \tag{13}\]  
\[X_{\text{CZT}}(k_{m}+1)=a_{0}\exp(j2\pi\varphi_{0})\times\exp\bigg{(}j2\pi \bigg{(}\frac{q(\delta-1)(N-1)}{MN}\bigg{)}\bigg{)}\times\frac{\sin\bigg{(}\pi \frac{2q(\delta-1)}{M}\bigg{)}}{\sin\bigg{(}\pi\frac{2q(\delta-1)}{MN}\bigg{)}} \tag{14}\]  
By using \(X_{\text{CZT}}(k_{m})\), \(X_{\text{CZT}}(k_{m}-1)\) and \(X_{\text{CZT}}(k_{m}+1)\), the bias correction factor \(\mu\) is constructed as:  
\[\mu=\frac{X_{\text{CZT}}(k_{m})-X_{\text{CZT}}(k_{m}+1)\exp\bigg{(}j2\pi \frac{q(N-1)}{MN}\bigg{)}\frac{\sin\bigg{(}\pi\frac{2q(\delta-1)}{MN}\bigg{)}} {\sin\bigg{(}\pi\frac{2q\delta}{MN}\bigg{)}}}{X_{\text{CZT}}(k_{m})-X_{\text{ CZT}}(k_{m}-1)\exp\bigg{(}-j2\pi\frac{q(N-1)}{MN}\bigg{)}\frac{\sin\bigg{(}\pi \frac{2q(\delta+1)}{MN}\bigg{)}}{\sin\bigg{(}\pi\frac{2q\delta}{MN}\bigg{)}}} \tag{15}\]  
By substituting (12), (13), and (14) into (15), \(\mu\) is derived as:  
\[\mu=\frac{\sin\bigg{(}\pi\frac{2q\delta}{M}\bigg{)}-\sin\bigg{(}\pi\frac{2q( \delta-1)}{M}\bigg{)}}{\sin\bigg{(}\pi\frac{2q\delta}{M}\bigg{)}-\sin\bigg{(} \pi\frac{2q(\delta+1)}{M}\bigg{)}} \tag{16}\]Through simple operations, (16) can be rewritten as:  
\[\mu=\frac{\tan\!\left(\pi\frac{2q\delta}{M}\right)-\tan\!\left(\pi\frac{2q\delta}{ M}\right)\cos\!\left(\pi\frac{2q}{M}\right)+\sin\!\left(\pi\frac{2q}{M}\right)}{ \tan\!\left(\pi\frac{2q\delta}{M}\right)-\tan\!\left(\pi\frac{2q\delta}{M} \right)\cos\!\left(\pi\frac{2q}{M}\right)-\sin\!\left(\pi\frac{2q}{M}\right)} \tag{17}\]  
From (17), the relationship between \(\mu\) and \(\delta\) is given by:  
\[\delta=\arctan\!\left(\frac{\left(\mu+1\right)\sin\!\left(\pi\frac{2q}{M} \right)}{\left(\mu-1\right)\!\left(1-\cos\!\left(\pi\frac{2q}{M}\right)\right) }\right)\frac{M}{2q\pi}=\arctan\!\left(\frac{\left(\mu+1\right)\cos\!\left(\pi \frac{q}{M}\right)}{\left(\mu-1\right)\sin\!\left(\pi\frac{q}{M}\right)} \right)\frac{M}{2q\pi} \tag{18}\]  
Then, the frequency bias \(\delta\) can be obtained from the bias correction factor \(\mu\) in (18).