Skip to main content

Welcome to a Grasp lesson

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

Lesson 44

Zero-Padding for DFT-based Linear Convolution

Recommended resources

Hello! Welcome to our next lesson.

In our previous session, we established a crucial theoretical link: while multiplying DFTs results in circular convolution, we can force this operation to yield a linear convolution result. The key, as we discovered, is to prevent time-domain aliasing by zero-padding the signals to a sufficient length, specifically , where and are the lengths of our input signals.

Today, we transition from theory to application. Your learning outcome is to apply zero-padding to compute linear convolution using the DFT/FFT. We will formalize the procedure that allows us to leverage the computational efficiency of the Fast Fourier Transform (FFT) to perform linear convolution, a method widely known as "fast convolution." This technique is a cornerstone of efficient digital filtering and system simulation in practice.

1. The "Fast Convolution" Algorithm

The convolution theorem for the DTFT, , is elegant but not directly computable, as is a continuous variable. The DFT provides a computational tool to perform a similar operation. By using the zero-padding strategy we derived, we can create a step-by-step algorithm to compute linear convolution using the DFT.

The following resource provides a concise summary of this procedure.

Discrete Fourier Transform (DFT)

This document outlines the practical steps for performing linear filtering (convolution) using the DFT. It directly addresses our learning goal for today.

Please read the section titled '3.6 Linear filtering through DFT (FFT)' on page 13 of the PDF. Focus on the step-by-step method described. Note the assumptions made about the signal lengths (P and M in the document correspond to our L and M).

Based on this resource and our previous discussion, we can formalize the algorithm as follows:

Let's say we want to compute the linear convolution , where has length and has length .

  1. Determine Output Length: Calculate the length of the linear convolution result, which is .
  2. Choose DFT Size (N): Select a DFT size such that . For computational efficiency, is almost always chosen to be the next power of 2 greater than or equal to . This allows the use of highly optimized Radix-2 FFT algorithms.
  3. Zero-Pad Signals: Create two new sequences, and , by appending zeros to and so that they both have length .
  4. Compute DFTs: Compute the N-point DFTs of the padded sequences, typically using an FFT algorithm.
  5. Multiply in Frequency Domain: Multiply the two DFTs element by element.
  6. Compute Inverse DFT: Compute the N-point Inverse DFT of the product, again using an efficient IFFT (Inverse FFT) algorithm.
  7. Extract Result: The resulting sequence of length contains the linear convolution. The first samples of are the desired output . The remaining samples will be approximately zero.

2. The Role of Zero-Padding: A Deeper Look

You now know the procedure and the fundamental reason it works: padding to provides enough "space" to prevent the time-aliasing inherent in circular convolution from corrupting the result.

However, zero-padding has another interpretation that's very insightful, especially from a signal processing perspective. What effect does appending zeros in the time domain have on the frequency domain representation?

Fourier transform frequencies and zero-padding

This video from Mike X Cohen explains the effect of zero-padding on the Fourier transform. It introduces a crucial concept: zero-padding increases frequency resolution, which is key to why our fast convolution method works.

Please watch from 30:12 to 38:35. Pay close attention to these three points: The definition of zero-padding (30:12 - 32:01). The visual effect in the frequency domain: the spectrum becomes 'smoother' because the DFT is computed at more frequency points (32:01 - 37:32). The speaker correctly identifies this as sinc interpolation. The third motivation for zero-padding given at 37:32, which is precisely our topic today: matching lengths for convolution.

As the video explains, padding a time-domain signal with zeros and taking a longer DFT is equivalent to evaluating the signal's underlying DTFT at a finer grid of frequencies. It doesn't add new information to the signal (the precision is unchanged), but it increases the resolution of our spectral view.

When we perform fast convolution, we are essentially doing the following:

  1. By padding and to length , we are finely sampling their respective DTFTs, and , at the frequencies .
  2. The multiplication gives us samples of the product spectrum .
  3. Because we took a sufficient number of samples (), the IFFT can perfectly reconstruct the time-domain signal from these frequency samples without time-aliasing. This is a direct application of the concepts we discussed when deriving the DFT from sampling the DTFT.
Test your understanding!

Let's apply this procedure to the signals from our last lesson:
for (so )
for (so )

Your task is to outline the steps to compute their linear convolution using the fast convolution method. You don't need to compute the actual DFT values, just describe the process and the dimensions of the signals at each stage.

  1. What is the length of the linear convolution output?
  2. What is a suitable power-of-2 choice for the DFT size, ?
  3. Write out the zero-padded sequences and using your chosen .
  4. After performing the FFTs, multiplication, and IFFT, what will be the length of the final output sequence ? How many of its samples constitute the actual linear convolution result?
Show answer
  1. Output Length: The linear convolution result will have length .
  2. DFT Size: We need . The smallest power of 2 that satisfies this is . However, to better illustrate the "extra" zeros in the final output, let's choose the next power of 2, which is . (In practice, both are valid choices, with being slightly more efficient).
  3. Zero-Padded Sequences (for N=8):
  4. Final Output: The IFFT will produce a sequence of length . The first samples will be the non-zero linear convolution result. The remaining samples will be zero (or numerically very close to it). For reference, the linear convolution is , so we would expect .

Conclusion

Today, you have translated the theoretical requirement of zero-padding into a concrete, practical algorithm for computing linear convolution. This "fast convolution" method is not just an academic exercise; it is fundamental to the performance of countless real-world DSP applications, from audio processing to communications and image filtering. Its efficiency gain over direct convolution is so substantial that it enables filtering operations that would be computationally prohibitive otherwise.

Key Takeaways:

  • Linear convolution of sequences with lengths and can be computed via the DFT/FFT.
  • The required procedure involves choosing a transform length , zero-padding both signals to length , performing the FFT, multiplying the spectra, and performing an IFFT.
  • The choice of as a power of 2 is not for correctness but for computational efficiency by enabling Radix-2 FFT algorithms.
  • Zero-padding in the time domain corresponds to finer sampling (interpolation) in the frequency domain, providing enough spectral points to reconstruct the full linear convolution result without time-domain aliasing.

Preview of the Next Lesson:

We have repeatedly mentioned the efficiency of the "Fast Fourier Transform" as the motivation for this entire procedure. But what exactly is the FFT, and why is it so much faster than the direct computation of the DFT? In our next lesson, we will finally pull back the curtain and derive the decimation-in-time (DIT) FFT algorithm and analyze its computational complexity compared to the direct DFT. You will see how a clever decomposition of the DFT calculation dramatically reduces the number of required operations.