# In the formula for the windowed Fourier transform, why is the complex-exponential term not time-shifted to the position of the window?

I have a question about the "windowed / short-time / short-term" Fourier transform that is somewhat perplexing me. I have now added an Addendum at the bottom, where the issue is presented more concisely through an example.



Idea of the Fourier transform

Given a "nice" function $f \colon \mathbb{R} \to \mathbb{R}$, we define the Fourier transform $\hat{f} \colon \mathbb{R} \to \mathbb{C}$ of $f$ by $$\hat{f}(\xi) \ = \ \int_{-\infty}^\infty f(\tau)e^{-2\pi i \xi\tau} \, d\tau.$$ If we write $\hat{f}(\xi)=A_\xi e^{i\phi_\xi}$ for each $\xi > 0$, then $$\hspace{47mm} f(\tau) \ = \ 2\int_0^\infty A_\xi\cos(2\pi\xi\tau + \phi_\xi) \, d\xi \hspace{47mm} \text{(1)}$$ for (almost) all $\tau \in \mathbb{R}$; therefore, we may naturally refer to $A_\xi$ and $\phi_\xi$ as being respectively the amplitude and initial phase associated to the frequency $\xi$.



Idea of the "windowed / short-time" Fourier transform

Now as I understand it, the windowed Fourier transform is meant to give a time-localised frequency spectrum analysis, of the following nature: At each time $t$, a complex number $\hat{f}_{\!\!\mathrm{short}}(\xi,t)$ is assigned to each frequency $\xi>0$, where the modulus and argument of $\hat{f}_{\!\!\mathrm{short}}(\xi,t)$ represent respectively the current amplitude and phase (at time $t$) of the frequency-$\xi$ sinusoidal component of $f$ locally around $t$. This is achieved by attenuating $f$ outside a small window which moves in time.



WFT at time $t=0$

Let us start by considering the amplitude and phase associated to $\xi$ at time $0$. We define a window function $g \colon \mathbb{R} \to [0,\infty)$ that is even, non-increasing on $[0,\infty)$, and rapidly decays outside some interval about $0$. Representing $f(\cdot)g(\cdot)$ as $$\hspace{40mm} f(\tau)g(\tau) \ = \ 2\int_0^\infty A_\xi\cos(2\pi\xi\tau + \phi_\xi) \, d\xi \, , \hspace{40mm} \text{(2)}$$ we define $$\hspace{32mm} \hat{f}_{\!\!\mathrm{short}}(\xi,0) \ = \ A_\xi e^{i\phi_\xi} \ = \ \int_{-\infty}^\infty f(\tau)g(\tau)e^{-2\pi i \xi\tau} \, d\tau. \hspace{32mm} \text{(3)}$$



WFT at time $t \neq 0$ (where my problem starts!)

We now wish extend this to localise around times $t$ other than $0$. I can think of two seemingly logical approaches, both of which end up being the same.

Approach 1. The "current amplitude and phase" should not need to make any reference to an arbitrary reference time "$t=0$"; so just do exactly the same as above, but relative to our new time $t$. In other words, representing $$\hspace{35mm} f(\tau+t)g(\tau) \ = \ 2\int_0^\infty A_\xi\cos(2\pi\xi\tau + \phi_\xi) \, d\xi \, , \hspace{35mm} \text{(4)}$$ define $$\hspace{27mm} \hat{f}_{\!\!\mathrm{short}}(\xi,t) \ = \ A_\xi e^{i\phi_\xi} \ = \ \int_{-\infty}^\infty f(\tau+t)g(\tau)e^{-2\pi i \xi\tau} \, d\tau. \hspace{27mm} \text{(5)}$$

Approach 2. Keeping the same function $g$, take our time-localisation window to be the function $g(\cdot - t)$ centred about $t$. Represent $$\hspace{35mm} f(\tau)g(\tau-t) \ = \ 2\int_0^\infty A_\xi\cos(2\pi\xi\tau + \tilde{\phi}_\xi) \, d\xi. \hspace{35mm} \text{(6)}$$ In this representation, for each $\xi$ the phase at time $0$ is $\tilde{\phi}_\xi$, so the phase at time $t$ is $2\pi\xi t + \tilde{\phi}_\xi$. Hence define $$\hspace{19mm} \hat{f}_{\!\!\mathrm{short}}(\xi,t) \ = \ A_\xi e^{i(2\pi\xi t + \tilde{\phi}_\xi)} \ = \ \int_{-\infty}^\infty f(\tau)g(\tau-t)e^{-2\pi i \xi(\tau-t)} \, d\tau. \hspace{19mm} \text{(7)}$$ Note that the integrals in $\text{(5)}$ and $\text{(7)}$ are the same, by the transformation $\tau \mapsto \tau-t$.

Actual definition of WFT. Apart from differences in convention about how $2\pi$ features in the formula for the Fourier transform, all the sources that I've encountered are unanimous in their definition for the WFT: $$\hspace{37mm} \hat{f}_{\!\!\mathrm{short}}(\xi,t) \ = \ \int_{-\infty}^\infty f(\tau)g(\tau-t)e^{-2\pi i\xi\tau} \, d\tau. \hspace{37mm} \text{(8)}$$

Note that the only difference between $\text{(7)}$ and $\text{(8)}$ is that the factor $e^{2\pi i \xi t}$ is missing from $\text{(8)}$. In other words: In $\text{(8)}$, the argument of $\hat{f}_{\!\!\mathrm{short}}(\xi,t)$ represents what the phase of the frequency-$\xi$ component of $f$ locally around $t$ would be at time $0$ if this component were extend back that far.

Why is $\text{(8)}$ used rather than $\text{(5)}$ / $\text{(7)}$?

This seems particularly bizarre, seeing as the WFT and the wavelet transform are often presented as being directly analogous in their aim, and yet the wavelet transform formula does follow the approach of performing exactly the same calculation relative to each new time $t$.

ADDENDUM - a concrete illustration. Take the "trivial" signal $f(t)=\cos(2\pi t)$. Let $g$ be the Gaussian window function $$g(\tau) \ = \ \frac{1}{\sqrt{2\pi}\sigma} e^{-\frac{\tau^2}{2\sigma^2}},$$ where the parameter $\sigma>0$ represents the frequency resolution. If my calculations are correct, the standard definition $\text{(8)}$ of the windowed Fourier transform $\hat{f}_{\!\!\mathrm{short}}$ gives that at frequency $\xi=1$, $$\hspace{23mm} \hat{f}_{\!\!\mathrm{short}}(1,t) \ = \ \tfrac{1}{2} \ + \ \tfrac{1}{2}e^{-8\pi^2\sigma^2}\!\big(\! \cos(4\pi t) - i\sin(4\pi t) \big). \hspace{23mm} \text{(9)}$$ So, as long as $\sigma$ isn't insanely small, we have that $$\hat{f}_{\!\!\mathrm{short}}(1,t) \ \approx \ \tfrac{1}{2} \hspace{5mm} \forall \, t \in \mathbb{R}.$$ In particular, the phase assigned to frequency $1$ remains approximately $0$ for all time. However, a time-frequency representation which gives the "current" amplitude and phase at time $t$, like the wavelet transform (or like my definition (5)/(7) for the WFT), would assign a phase of $2\pi t$ at time $t$.

• oh dear. this is painful to sift through. Jan 14, 2018 at 3:42
• There are many different phase gauges that make sense in different situations. Use the one that works for you and understand that it is easy enough to convert between them. Jan 14, 2018 at 13:29
• The underlying reason for the non-existence of a universal phase gauge is the non-commutativity of the Heisenberg group that acts like translations on the time frequency plane. Jan 14, 2018 at 13:32
• @Jazzmaniac: Okay, thanks. So to illustrate a possible use of the usual definition (8): If it were applied to $f(t)=\cos(2\pi\nu t+\alpha)$, it should assign a phase of approximately $\alpha$ to the frequency $\nu$ at all times $t$. Therefore, more generally, one can use (8) to search for perturbations in phase dynamics [which is often significant in its own right apart from variations of amplitude] by simply looking for temporal changes in the phases assigned by (8). This would be harder using (5), as (5) gives the "current" phase, which is always changing for a fixed oscillatory motion. Jan 14, 2018 at 15:16

Your concern is legitimate. The shifted expression is found in this paper,

$$S_x(u, f) = \int_{-\infty}^{\infty} x(t) g(t-u)e^{-2\pi i f (t - u)} dt$$ which unfortunately isn't explained at all there, but it is in the former link. Implementation at ssqueezepy.

One usually wants the local properties of each DFT window to be invariant. If cosines represent the evenness of each window’s content, and sines the oddness, then Eulers identity does not allow rotating the complex exponential basis vectors differently with respect to each window’s center for different full DFT window offsets.

Whereas a non-local-to-window-center phase reference requires that such an absolute reference point exists and is useful. But midnight 1970 or 14.3B BCE are rarely useful. However for fictional continuous waveforms that extends in time past the lifetime of the universe, calling some random point t=0 for an FT can save some chalk on the classroom chalkboard.

• Surely this issue would just be resolved just by applying discretisation to expression (5) rather than expression (7). Or am I misunderstanding something? Jan 14, 2018 at 15:27
• (More generally I would have thought that this kind of practical issue can typically be solved by modifying the desired expression to a new expression that can nicely be calculated using standard algorithms, and then transforming the result back to give a result for the desired expression. Maybe in some situations this is much harder than in other situations - but in the present situation it is very easy: the transformation back is simply multiplication by the factor $e^{2\pi i\xi t}$. So this issue should not affect the actual mathematical definition that is chosen.) Jan 14, 2018 at 15:36
• Thanks for the new paragraph in your answer. I don't see how for the windowed FT, working with an arbitrary reference time as in (8) would save any chalk on the chalkboard; (8) seems no simpler than (5). Jan 14, 2018 at 21:05

Based on Instantaneous phase and frequency article, I guess that FT and WFT by definition always return $$\theta$$ "phase/phase offset" (which is unambiguously relative to $$t = 0$$), not $$\varphi (t)$$ "instantaneous phase/local phase/phase". The local phase can be easily obtained by $$\varphi (t) = \omega t + \theta$$