Thursday, June 29, 2017

noise - Optimal window function for amplitude estimation?



Assume you want to estimate the amplitude of a known frequency sinusoid in additive Gaussian (white or pink) noise. Also assume mainlobe width/sidelobe decay doesn't matter. Windows should be compared such that the time latency of the resulting amplitude estimate is equal. (I believe for all symmetric windows of a given period, their time latency will be equivalent -- specifically, equal to half of their period.) What is the optimal window in this case?


It seems this problem would simply reduce to what window has the smallest magnitude integral in the frequency domain (affects amount of noise smeared around) relative to its peak magnitude in the frequency domain (what will be used to estimate amplitude). However, given the presumably random phases of each noise frequency component, I am not sure it is as simple as just considering the magnitude of the window's fourier transform because there may be some 'destructive interference' among noise components of different phase.


The main two contenders I am aware of are: the rectangular window, which is said to have the minimum equivalent bandwidth noise for any window of its length (source); and the Gaussian window, which is said to minimize the 'time-frequency bandwidth product' (source). However, time-bandwidth product refers to the 'frequency duration' (sidelobe behavior) of a signal, which was stated to not matter in this case, so I don't think that optimality is useful here.


Therefore, I believe the goal would be to minimize the equivalent noise bandwidth of the window. If that is the case, how would one prove that the rectangular window does minimize ENBW, and that there is not some other obscure window in the function space that does 'better'? Here is an illustration of the 'optimality' in the ENBW-sense of the rectangular window (source):


enter image description here


Additionally, here are the corresponding time/frequency plots of rectangular and Gaussian windows, making it appear that the Gaussian window is much more spread out in frequency than the rectangular function and therefore does not have as high of a 'peak relative to frequency domain integral'. (Compare +/-5Hz, maybe +/-2.5Hz if window lengthened for Gaussian vs +/-1Hz for rectangular of same time duration.) (source_rect, source_Gauss):


enter image description here


enter image description here




Edit: I want to mention the possibility of a non-symmetric window function, since the goal is to optimize the amplitude estimate relative to a fixed measurement latency. My intuition is that it may be possible to use a 'ramp' window to more heavily weight the most recent samples, and allow the overall window size to be greater.



For instance, consider the following window of length $T$ with integral 1:


$$w(t) = \left \{\begin{array}{ll} \frac{2t}{T^2} & t\in (0,T] \\ 0 & t\not\in (0,T]\\ \end{array} \right.$$


E.g., for $T = 2$: enter image description here


If we define the window latency as a linear weighting based on their time offset relative to the last sample taken, then for a window of length $T$:


$$weight_T(t) \triangleq T-t$$


As we would expect, a rectangular window $\frac{1}{T}rect\frac{t}{T}$ with integral 1 has latency:


$$\int_{0}^{T} \frac{1}{T}\cdot weight_T(t) dt = \frac{T}{2}$$


In the case of the ramp window, the latency is:


$$\int_{0}^{T} \frac{2t}{T^2}\cdot weight_T(t) dt = \frac{T}{3}$$


This implies that the ramp window can be 50% longer than the rectangular window and still have the same time latency.



Using the approach given in the answer below, which requires that the sum of the (discrete time) window coefficients = 1, we could for instance compare the total signal variance between a rectangular window of length 10 and a ramp window of length 15. Each rect window coefficient would = $\frac{1}{10}$, such that the total variance (assuming unit variance AWGN) would be:


$$\sigma^2_{rect} = (10)(\frac{1}{10})^2 = .1$$


The ramp window would have coefficients:


$$a_{ramp} = \{1,2,...,15\}\cdot (\frac{1}{120})$$


You can verify that the sum of these coefficients = 1. This would result in variance:


$$\sigma^2_{ramp} = \{1^2 + 2^2 + ... + 15^2\}\cdot (\frac{1}{120})^2 \approx .08611 $$


Therefore, it would seem that the ramp window would perform better than a rect window in AWGN for a given amplitude measurement latency. The only practical caveat would be that the ramp window may suffer from larger discontinuities (i.e. if first sample does not have similar value to last sample).


Here's a comparison of the magnitude response for a ramp window of length 1.5 vs a rect window of length 1, and their difference:


enter image description here enter image description here enter image description here


It does seem that the rect window has a generally smaller magnitude response than the ramp function. However, maybe the complex components of the ramp Fourier transform result in destructive interference among the noise components?




Answer



Consider a window just three samples long, $[a, b, c]$. To enforce symmetry, we rewrite the window as $[a, b, a]$. As an estimate $A(\omega)$ of the amplitude of angular frequency $\omega$, we'd calculate:


$$A(\omega) = \left|\sum_{i=0}^2 e^{-i k\omega}[a, b, a]x[k]\right| = \Big|ax[0] + e^{-i\omega}bx[1] + e^{-i2\omega}ax[2]\Big|$$


I'm using zero-based indexing here. When noise is not present, the above will only work perfectly if $a+b+a = 1$, so we can rewrite the window as $[a, 1-2a, a]$. For simplicity, let's estimate the amplitude of frequency $\omega = 0$ by:


$$A(0) = \left|\sum_{i=0}^2 [a, 1-2a, a]x[k]\right| = \Big|ax[0] + (1-2a)x[1] + ax[2]\Big|$$


If $x[k]$ have additive white noise with zero mean and a variance of $1$ (I mean that the noise comes from such a distribution), then the windowed samples have errors with variances $[a^2, (1-2a)^2, a^2]$. Because the noise is white, the distributions of the errors are independent and their sum will have variance that is the sum of their variances, $a^2+(1-2a)^2+a^2$. Plotting that:


Plot of the variance of error
Figure 1. Variance $a^2+(1-2a)^2+a^2$ of the error as function of the window parameter $a.$


The potentially complex number $ax[0] + (1-2a)x[1] + ax[2]$ describes both phase and amplitude, the latter of which is extracted by taking the absolute value. The error due to noise in that number is zero-mean, so we may wish to minimize the variance of that error. The minimum variance $1/3$ is at $a = 1/3$, which means that the optimal window is $[1/3, 1/3, 1/3]$. That is not a proof but a pretty good indication that the rectangular window minimizes the error in phase and amplitude estimation in presence of additive zero-mean white noise.


Had we not imposed symmetry, the window would be $[a, 1-a-c, c],$ and the variance of the error to minimize would be $a^2 + (1 - a - c)^2 + c^2.$ Requiring the partial derivatives with respect to each of $a$ and $c$ to equal zero would give the same optimal window as before:



$$\cases{4a + 2c - 2 = 0\\ 2a + 4c - 2 = 0}\\ \begin{align} &\Rightarrow a = \frac{1}{3},\quad c = \frac{1}{3}\\ &\Rightarrow 1-a-c = \frac{1}{3}\end{align}$$


No comments:

Post a Comment

periodic trends - Comparing radii in lithium, beryllium, magnesium, aluminium and sodium ions

Apparently the of last four, $\ce{Mg^2+}$ is closest in radius to $\ce{Li+}$. Is this true, and if so, why would a whole larger shell ($\ce{...