Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 58

Heisenberg's Uncertainty Principle and the STFT

Recommended resources

Hello! Welcome to the next lesson in our course on Digital and Analog Signal Processing.

In our previous session, we introduced the Short-Time Fourier Transform (STFT) as a powerful tool for analyzing non-stationary signals. We discovered that the STFT comes with a fundamental trade-off: a short analysis window provides good time resolution but poor frequency resolution, while a long window does the opposite. You correctly identified how to choose the window size based on the signal characteristics in our mini-exercise.

Today, we will delve deeper into this trade-off. Our goal is to apply the uncertainty principle to explain the time-frequency resolution trade-off in the STFT. We will see that this is not just a quirk of the STFT algorithm, but a fundamental, inescapable property of all signals, rooted in the mathematics of the Fourier transform.

1. The Uncertainty Principle: An Intuitive Start

Before diving into the mathematics, let's build an intuition for the core idea. The concept that you can't simultaneously know "when" and "what frequency" with perfect precision is something you already experience.

The more general uncertainty principle, regarding Fourier transforms

The 3Blue1Brown video 'The more general uncertainty principle, regarding Fourier transforms' provides an excellent intuitive introduction to this concept. It uses everyday examples to build a strong conceptual foundation.

Please watch from 00:46 to 07:04. First, focus on the intuitive examples of car turn signals and musical notes. Then, observe how this intuition is visualized using the Fourier transform, showing that a signal concentrated in time must have a spread-out frequency spectrum.

As the video explains, a short event (like a clap) is ambiguous in frequency, while a pure tone requires a long duration to be identified precisely. The Fourier transform is the mathematical tool that makes this relationship explicit:

  • A signal that is compact or highly localized in the time domain will have a Fourier transform that is spread out in the frequency domain.
  • Conversely, a signal that is compact or highly localized in the frequency domain (like a pure sine wave) must be spread out in the time domain.

The video also touches on a practical application in Doppler radar, which is a great analogy from your field of electrical engineering. Determining an object's precise location requires a short, sharp pulse, but this makes its velocity (related to frequency via the Doppler shift) uncertain. Conversely, determining precise velocity requires a long pulse, which makes its exact location ambiguous. This is the same fundamental trade-off.


2. Quantifying "Spread": The Time-Bandwidth Product

To move from intuition to a formal principle, we need to mathematically define the "spread" or "duration" of a signal in both time and frequency. A common and powerful way to do this is by using the concept of variance, similar to how it's used in probability and random processes.

For a signal that is centered at and has unit energy , we can define its effective duration and bandwidth as follows:

  • The time spread (or RMS duration) is the standard deviation of the signal's energy distribution in time:

  • The frequency spread (or RMS bandwidth) is the standard deviation of its energy distribution in frequency, where is frequency in Hertz (Hz):

    Here, is the Fourier Transform of .

These two quantities are not independent. They are linked by the Heisenberg Uncertainty Principle for Fourier transforms.

Lecture 16 Limitations of the Fourier Transform: STFT

This lecture note provides a clear and concise mathematical statement of the uncertainty principle.

Please read Section 16.5, 'FT Uncertainty Principe: a Fundamental Limitation of Fourier Analysis'. Focus on Equation 16.2, which is the formal statement of the principle, and the interpretation that follows.

As stated in the notes, the principle is the inequality:

Taking the square root of both sides gives us the relationship between the RMS duration and RMS bandwidth:

Often in signal processing, we work with angular frequency . Since , we can substitute this into the inequality to get the more common form:

This is a profound result. It states that the product of a signal's effective duration and its effective bandwidth (often called the time-bandwidth product) has a fixed lower bound. No signal can be arbitrarily narrow in both the time and frequency domains simultaneously.


3. The Uncertainty Principle in the STFT

How does this general principle apply specifically to the STFT? In the previous lesson, we saw that the STFT calculates the spectrum of a windowed portion of the signal. The properties of the STFT are therefore not determined by the signal itself, but by the window function .

  • The time resolution of the STFT is determined by the duration of the window function, of . A narrower window gives better time resolution.
  • The frequency resolution of the STFT is determined by the bandwidth of the window function's Fourier transform, of . A narrower spectrum for the window gives better frequency resolution.

The uncertainty principle applies directly to the window function : .
This means that when you design your STFT:

  • If you choose a window that is very narrow in time (small ), its Fourier transform must be wide (large ). This gives good time resolution but poor frequency resolution.
  • If you choose a window whose transform is very narrow in frequency (small ), the window itself must be wide in time (large ). This gives good frequency resolution but poor time resolution.

This is precisely the trade-off we observed in the last lesson, but now we see it as a direct consequence of a fundamental mathematical limit.

The following image perfectly visualizes this concept by showing how the time-frequency plane is "tiled" by the STFT. The area of each "tile" represents the time-bandwidth product of the window, which is constant.

STFT Time-Frequency Resolution Trade-off with Different Window Lengths
This image illustrates the STFT resolution trade-off. The analysis window defines a 'tile' in the time-frequency plane. A short window (left) creates tiles that are narrow in time but wide in frequency, good for resolving temporal events. A long window (right) creates tiles that are wide in time but narrow in frequency, good for resolving spectral components. The area of the tile is fundamentally limited by the uncertainty principle.
Test your understanding!

You are using the STFT to analyze a signal and find that you cannot distinguish two sine waves that are very close in frequency. According to the uncertainty principle, what must you do to your window's properties to improve this, and what will be the inevitable consequence?

Show answer

To better distinguish the two closely spaced sine waves, you need to improve your frequency resolution. According to the uncertainty principle, this requires using a window with a narrower bandwidth (). The inevitable consequence is that this window must have a longer duration (), which will degrade your time resolution. You are trading temporal precision for spectral precision.


4. The Optimal Window: The Gaussian Function

The uncertainty principle is an inequality. This implies that some functions are more "efficient" than others in packing their energy. This raises a natural question: does any function achieve the theoretical minimum?

The answer is yes. The Gaussian function is unique in that it is the only function that satisfies the uncertainty principle with equality:

This means a Gaussian window provides the best possible simultaneous localization in both time and frequency that the uncertainty principle allows. No other window shape can achieve a smaller time-bandwidth product.

This special property is why the Gaussian function is central to time-frequency analysis. In fact, this is precisely what Dennis Gabor used in his pioneering 1946 paper where he introduced this transform, which is why the STFT is often called the Gabor Transform.

Time Frequency Analysis & Fourier Transforms

The following segments from Professor Nathan Kutz's lecture provide further mathematical and historical depth on these concepts.

Please watch the following three clips from the video: Historical Context (11:58 - 13:57): This section discusses Gabor's work in 1946 and its connection to radar technology, which aligns with your interest in historical development. Visualizing the Uncertainty Principle (32:47 - 37:44): This part presents a powerful cartoon visualization of how time series analysis, Fourier analysis, and Gabor/STFT analysis resolve information differently in the time-frequency plane. Gabor's Gaussian Window (41:56 - 43:41): Here, it's explicitly mentioned that Gabor's original work used a Gaussian window and its connection to quantum mechanics, which offers a deeper perspective.

The connection to quantum mechanics mentioned in the last clip is not accidental. The Heisenberg uncertainty principle in quantum mechanics, which relates the uncertainty in a particle's position and momentum, is mathematically the same principle. Position and momentum wavefunctions are a Fourier transform pair, just like time and frequency.


Conclusion

In this lesson, we have put the time-frequency trade-off of the STFT on solid mathematical ground using the uncertainty principle.

Key Takeaways:

  • The Uncertainty Principle for Fourier transforms states that a signal cannot be arbitrarily localized in both the time and frequency domains.
  • This is quantified by the time-bandwidth product inequality, , where and are the RMS duration and bandwidth of the signal.
  • In the STFT, this principle applies to the window function. The time resolution is set by the window's duration, and the frequency resolution is set by its bandwidth.
  • The choice of a window's duration forces a trade-off: a narrow window in time must have a wide spectrum (good time res, poor freq res), and vice versa.
  • The Gaussian function is the optimal window in the sense that it achieves the theoretical minimum of the time-bandwidth product.

Preview of the Next Lesson:

The fixed "tiling" of the time-frequency plane is a limitation of the STFT. A short window gives poor frequency resolution everywhere, even for low-frequency components where we might want it. A long window gives poor time resolution everywhere, even for high-frequency transients. What if we could have a transform that adapts its resolution, using short windows for high frequencies and long windows for low frequencies? This is the motivation for the Wavelet Transform. In the next part of the course, we will not cover wavelets in detail, but we will move on to another practical consideration of digital signal processing: the effects of representing signals and filter coefficients with finite precision. Our next lesson will analyze the effects of fixed-point and floating-point quantization.