# How I can prove that the short-time Fourier transform (STFT), preserves energy density of the signal?

How I can prove that the short-time Fourier transform (STFT), preserves energy density of the signal; that is:

$$\int_{-\infty}^\infty\int_{-\infty}^\infty|STFT(t,f)|^2 dtdf = \int_{-\infty}^\infty|x(t)|^2 dt = \int_{-\infty}^\infty|X(f)|^2 df = E_x$$

The STFT of a signal is: $$STFT(x) = \int_{-\infty}^\infty x(t)w(t-τ)e^{-2\Pi ift}dt$$

• Conservation of energy depends on the choice of window function (shape and overlap). It can't be proven to be generally true because it isn't – Hilmar Nov 6 '16 at 23:50
• @Hilmar not really – reuns Nov 7 '16 at 0:19

If you consider the STFT of a continuous signal without any sampling, then by Parseval's theorem $$X(t,f)= \int_{-\infty}^\infty w(t-\tau)x(\tau)e^{-2i \pi f \tau} d\tau$$ $$\implies \int_{-\infty}^\infty \int_{-\infty}^\infty |X(t,f)|^2df dt=\int_{-\infty}^\infty \int_{-\infty}^\infty|w(t-\tau)|^2 |x(\tau)|^2 d\tau dt = A \int_{-\infty}^\infty |x(\tau)|^2 d\tau$$ where $A = \int_{-\infty}^\infty |w(t)|^2 dt$

Now in real life you consider a sampled signal $x(n)$ and a sampled STFT : $$X(m,f) = \sum_{n=-\infty}^\infty w(mT-n) x(n) e^{-2i \pi f n}$$ (the frequency domain is sampled too at $f = \frac{k}{K}$ with $K \ge L$ the length of the window)

By inverse discrete Fourier transform, you can recover $$w(mT-n) x(n) = \frac{1}{K}\sum_{k=0}^{K-1} X(m,k/K)e^{2i \pi k n/K}$$

In general, the window $w(n)$ is chosen to allow the perfect reconstruction of the signal, that is $$\sum_{m=-\infty}^\infty w(mT-n) = C \implies x(n) = \frac{1}{C}\sum_{m=-\infty}^\infty \frac{1}{K}\sum_{k=0}^{K-1} X(m,k/K)e^{2i \pi nk/K}$$ This is the case with the Hanning window $w(n) = (\frac{1}{2}-\cos(\pi n/N))1_{n \in [0,N]}$, where $N/T$ is a multiple of $2 \quad$ ($N/T > 2$ means over-sampling).

Now $N/T > 2$ allows for a better time resolution of the spectrum, but not only.

An other desirable property is the conservation of the energy of the signal : $$\sum_{m=-\infty}^\infty w(mT-n)^2 = A$$

$$\implies \sum_{n=-\infty}^\infty |x(n)|^2 = \frac{1}{A}\sum_{m=-\infty}^\infty \sum_{k=0}^{K-1} |X(m,k/K)|^2$$ Those two properties, perfect reconstruction and energy conservation are the reason why we often choose the Hanning window with $N/T \ge 4$, or the Hanning window squared, or a mix of those with the rectangular window (the Blackman and the Hamming window)

• Thank you for your answer, but I don't understand why you say that: $$\int_{-\infty}^\infty\int_{-\infty}^\infty|X(t,f)|^2 dfdt = \int_{-\infty}^\infty\int_{-\infty}^\infty|w(t-τ)|^2|x(τ)|^2 dτdt$$ That expression should not be so: $$\int_{-\infty}^\infty\int_{-\infty}^\infty|X(t,f)|^2 dfdt = \int_{-\infty}^\infty\int_{-\infty}^\infty { |\int_{-\infty}^\infty x(t)w(t-τ)dτ|}^2 dfdt$$ – Ainor Fistroy Fistroy Nov 7 '16 at 2:47
• @AinorFistroyFistroy Let $Y(f) = X(t,f)$ it is the Fourier transform of $y(\tau) = w(t-\tau)x(\tau)$ therefore by Parseval's theorem $\int_{-\infty}^\infty |Y(f)|^2 df = \int_{-\infty}^\infty |y(\tau)|^2 d\tau$ – reuns Nov 7 '16 at 3:07
• And you have to read a course on the Fourier series before looking at the Fourier transform – reuns Nov 7 '16 at 3:13
• Thank you again for everything and for last I want ask you one thing more: If the window $$w(t-τ)$$ is gaussian, say that, depends of two variables time and frequency $$w(t-τ,f)$$ Then the result is the same? – Ainor Fistroy Fistroy Nov 7 '16 at 13:43
• @AinorFistroyFistroy when $w$ depends on $f$, it is a filter bank transform, for example the en.wikipedia.org/wiki/Wavelet_transform. And no, the result isn't the same (why would it be ?). So you need to read a course on the Fourier series and the discrete Fourier transform, and only after that, you can look at the Fourier transform and the STFT. – reuns Nov 7 '16 at 22:10