# Demystifying DFT-Based Harmonic Phase Estimation, Transformation, and Synthesis
## 2 Robust DFT-Based Phase Estimation of Individual Sinusoids
### Bias and Variance of the Phase Estimation Error  
We complete this section (Section 2) with an assessment of the bias, and of the variance of the phase estimation error that results from the estimators that are explained in Section 2.1 (Equation (10)), and in Section 2.4 (Equation (21)). Bias is computed using \(\text{mean}\{\phi-\hat{\phi}\}\). Variance is computed using \(\text{var}\{\phi-\hat{\phi}\}\), and we take as a reference the Cramer-Rao lower bound (CRLB) for the error variance of an unbiased phase estimator [17] (page 33). Figure 9: Cumulative phase estimation error as a function of the fractional frequency \(\Delta_{\ell}\), when the ODFT and the sine window are used. In the illustrated cases, \(N=128\), \(\ell=13\), \(\text{SNR}=30\) dB (**left**) and \(\text{SNR}=10\) dB (**right**). Assuming that both magnitude and frequency of the sinusoid are known--which is true in our simulations, this CRLB is given by the following:  
\[\text{var}\{\phi-\hat{\phi}\}=\frac{2\sigma^{2}}{NA^{2}}\, \tag{26}\]  
where \(\sigma^{2}\) is the variance of real-valued white Gaussian noise. As the results in Figures 5 and 9 make clear, the phase estimation error is influenced by--although it does not directly depend on-- the fractional frequency \(\Delta_{\ell}\), which we represent in this context simply as \(\Delta\) given that we are considering just one sinusoid. Hence, we evaluate the bias and variance of the phase estimation error in two almost extreme situations: when \(\Delta=-0.49\) or when \(\Delta=0.00\) in the case of the estimator given by Equation (10), and when \(\Delta=0.01\) or when \(\Delta=0.5\) in the case of the estimator defined by Equation (21). In our simulations, \(N=128\) and \(\ell=13\). Results are obtained when the SNR varies from 0 dB to 30 dB in steps of 2.5 dB. For each particular SNR value, the bias and variance of the phase estimation error are computed when \(\phi\) varies between \(-\pi\) and \(+\pi\) in 200 steps and, at each step, stable statistics are reached after 100 Monte Carlo runs accounting for noise contamination. Figure 10 displays representative results regarding bias. Results reveal that in all six cases, bias reduces as the SNR increases, as expected. However, there is not a specific combination of DFT-based filter bank and window that stands out. This remains true even after multiple runs of the simulations, although a relative degradation can be observed that persists for the tested rectangular window context (i.e., DFT filter bank and rectangular window) under more adverse \(\Delta\) conditions (i.e., when \(\Delta\) approaches \(-0.5\) to \(0.5\)), which is easily explained by the poor leakage characteristics of the rectangular window. In general, it can be concluded that bias is fairly low, in the order or less than 0.001 radians for SNR equal to or larger than 2.5 dB. This represents less than 0.016% of the \(2\pi\) dynamic range. The most significant results regard estimation error variance and are shown in Figure 11.  
Figure 10: Mean over 100 Monte Carlo runs of the phase estimation error when \(N=128\), \(\ell=13\), and when \(\Delta\) takes on two extreme values depending on the estimator. It is an interesting and somewhat unexpected outcome that the rectangular window gives rise to the best results when the tested \(\Delta\) conditions are more favorable (i.e., when \(\Delta=0.0\)), and to the worst results when the tested \(\Delta\) conditions are more adverse (i.e., when \(\Delta=-0.49\)). In the former case, the performance reaches the CRLB because in that ideal case, there is no leakage, as already noted at the end of Section 2.1, which means that the error variance is entirely due to noise contamination. It should be noted that in practice, this rarely happens with real-world, natural, signals as it is quite unlikely that the analyzed frequencies are exactly aligned with the center frequencies of the sub-bands of the DFT-based filter bank.