Coherent gain of a window (source code)

= Coherent gain of a window

The coherent gain of a discrete <window function> is its mean coefficient:
$$
G_c=\frac1N\sum_{n=0}^{N-1}w_n.
$$
It describes the amplitude scaling of a coherent complex tone under the chosen DFT normalization. Window coefficients and their normalization must be specified; a window's name alone does not fix every finite-length convention.<LabVIEW Analysis Concepts by National Instruments>[Printed pages 5-20–5-24, periodic/symmetric windows and coherent-gain scaling]{ref}

For $x_n=Ae^{i(2\pi k_0n/N+\phi)}$, multiply by $w_n$ and evaluate the unnormalized <discrete Fourier transform> at the exact tone bin:
$$
X_w[k_0]=Ae^{i\phi}\sum_nw_n=NAe^{i\phi}G_c.
$$
Thus $|X_w[k_0]|/(N|G_c|)$ recovers $A$ when $G_c\ne0$. This result is exact for this complex-tone model. A real cosine also has a negative-frequency component; the usual doubled one-sided amplitude requires that its contribution to the chosen positive-frequency bin be absent or separately accounted for.

A <rectangular window> has $G_c=1$. The periodic <Hann window> $w_n=(1-\cos(2\pi n/N))/2$ has $G_c=1/2$ for $N>1$. Its coherent bin therefore has half the unwindowed amplitude before correction. The symmetric endpoint convention $w_n=(1-\cos(2\pi n/(N-1)))/2$, for $N>2$, instead gives $G_c=(N-1)/(2N)$. At $N=64$ this is $0.4921875$, so blindly multiplying by two is not the exact correction for that convention.

Coherent gain does not correct every amplitude error. An off-bin tone samples the window's frequency response away from its maximum, and a DC-removing window with zero sum has no usable gain correction at all. <Coherent sampling>, leakage and window normalization are distinct conditions.

Noise uses a different scaling. For independent equal-variance samples, a weighted DFT bin's noise variance is proportional to $\sum_nw_n^2$, not $(\sum_nw_n)^2$. This motivates equivalent noise bandwidth in bins,
$$
B_e=\frac{N\sum_nw_n^2}{(\sum_nw_n)^2},
$$
which is $3/2$ for a periodic Hann window with $N>2$. The manufacturer's table lists both coherent gain and noise bandwidth rather than treating one as a substitute for the other.<LabVIEW Analysis Concepts by National Instruments>[Table 5-3, Hanning amplitude and ENBW factors]{ref}