Skip to main content

Welcome to a Grasp lesson

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

Lesson 51

FIR Filter Design: Frequency Sampling Method

Recommended resources

Hello! Welcome to your next lesson on digital filter design.

In our last session, we focused on the window design method. We began with an ideal impulse response in the time domain, truncated it to make it finite, and then applied smooth window functions to manage the trade-off between transition bandwidth and stopband attenuation.

Today, we will explore a completely different, yet equally fundamental, approach to FIR filter design. The learning outcome for this lesson is to design FIR filters using the frequency sampling method.

Instead of starting in the time domain, this method begins in the frequency domain. We will directly specify the desired frequency response at a set of discrete points and then use the Inverse Discrete Fourier Transform (IDFT) to find the required filter coefficients. This approach provides a powerful link between the DFT theory you know and practical filter design.

This lesson will cover:

  • The mathematical basis of the frequency sampling method as an approximation of the inverse DTFT.
  • The core procedure: sampling the frequency response and applying the IDFT.
  • A critical side effect of this method: time-domain aliasing, and why it impacts filter performance.
  • A step-by-step design example to solidify your understanding.

1. The Core Idea: From Frequency Samples to Filter Taps

Recall that a filter's impulse response, , and its continuous frequency response, , are related by the Discrete-Time Fourier Transform (DTFT) pair:

For an ideal filter, like a "brick-wall" low-pass filter, is well-defined. However, as we saw in the last lesson, the resulting is an infinitely long sinc function. The window method tackled this by truncating .

The frequency sampling method approaches this differently. Instead of solving the integral analytically, we approximate it using a numerical technique you've likely encountered in calculus: a Riemann sum.

Why does the frequency sampling method for FIR filter design operate in this manner?

This article on the DSP Stack Exchange provides an excellent mathematical derivation that shows how the frequency sampling method arises from approximating the IDTFT integral. This will give you the deep mathematical 'why' behind the method.

Please read the answer provided by the user 'robert bristow-johnson'. Focus on how the continuous integral for h[n] is approximated by a Riemann sum over N frequency points, and how this naturally leads to the Inverse DFT (IDFT) formula. This is the theoretical heart of the frequency sampling method.

As the resource explains, by sampling the desired frequency response at equally spaced frequencies , we transform the continuous integral into a discrete sum. The resulting approximation for the impulse response is precisely the N-point IDFT of the frequency samples :

This gives us a simple, powerful, three-step procedure for designing an FIR filter of length :

  1. Define the ideal frequency response, .
  2. Sample at points to get the discrete frequency samples, .
  3. Calculate the N-point IDFT of to obtain the filter coefficients, .
Frequency Sampling Design Method for FIR Filters
This image visually summarizes the frequency sampling method. The desired continuous frequency response (top left) is sampled at discrete points (bottom), creating the frequency samples \(H[k]\). The filter coefficients \(h[n]\) are then found by taking the IDFT of these samples, as shown by the formula (top right).

2. The Catch: Time-Domain Aliasing

You know from sampling theory that sampling a signal in the time domain causes its spectrum to become periodic in the frequency domain. The duality principle of the Fourier transform implies the reverse: sampling in the frequency domain causes the time-domain signal to become periodic.

When we use the IDFT to find , we are implicitly creating a periodic version of the ideal impulse response. For a typical low-pass filter, the ideal impulse response is a sinc function, which is infinitely long. The frequency sampling process effectively causes this infinite sinc function to be repeated every samples. The tails of the infinitely repeating sinc functions "wrap around" and add to the main lobe of the primary period. This effect is called time-domain aliasing.

Time-Domain Aliasing due to Frequency Sampling
This figure from the Stack Exchange article illustrates time-domain aliasing. The ideal impulse response (a sinc function) is infinite. Sampling in the frequency domain creates a periodic version of this signal, where the tails from adjacent periods overlap, distorting the impulse response within the primary period of N samples.

What's the consequence?
The frequency response of the filter we design will be perfect at the sample points . However, between these sample points, the response can deviate significantly, often resulting in large ripples in the passband and poor attenuation in the stopband. This is the primary drawback of the basic frequency sampling method compared to the windowing method for an equivalent filter length.


3. A Practical Design Procedure

Despite its limitations, the frequency sampling method is straightforward to implement. Let's walk through the practical steps, including an important detail for ensuring the filter coefficients are real.

How to Design FIR Filters using frequency sampling method | Discrete Time Signal Processing

This video from Ekeeda outlines the general process and introduces an important practical consideration: ensuring the filter coefficients are real-valued.

Watch from the beginning to 12:12. Focus on the three main steps: defining H_d(e^jω), sampling to get H(k), and applying the IDFT to get h(n). Pay close attention to the modified IDFT formulas presented from 06:26 onwards. These are used to guarantee that the resulting impulse response h[n] is real, which is necessary for any practical filter. Note the separate cases for even and odd filter lengths (N).

The video highlights a crucial point. For the impulse response to be real-valued, its DFT, , must have complex conjugate symmetry: . The modified IDFT formulas shown in the video are simply efficient ways of computing the IDFT while enforcing this symmetry, saving you from calculating the full complex sum.

Now, let's see this procedure applied to a concrete example.

Problem on Design of FIR Filters using frequency Sampling Method | Discrete Time Signal Processing

Let's walk through a concrete example. This video designs a 7th-order low-pass filter using the method we just discussed.

Watch the entire video. Follow the steps carefully: Defining H[k] (0:00 - 11:27): See how the ideal frequency response is defined and then sampled. Pay attention to how the cutoff frequency (π/2) is mapped to a discrete index k and how the symmetry condition is implicitly handled. Applying IDFT (11:27 - end): Observe the application of the special IDFT formula for an odd filter length (N=7) to derive the final equation for the impulse response coefficients, h[n].

Test your understanding!

You want to design an ideal low-pass FIR filter of length N=9. The desired cutoff frequency is . The frequency samples are taken at .

For which values of the index (from 0 to 8) will the ideal frequency response samples be equal to 1?

(Hint: The passband is . Find the largest such that . Remember that due to symmetry, if is in the passband, then is also in the passband.)

Show answer

The passband is for .
Let's check the values of :

  • : . So, .
  • : . So, .
  • : . So, .
  • : . So, .
  • : . So, .

Due to symmetry, , so . With N=9:

  • .
  • .
  • .
  • .

Therefore, for .


4. Evaluating the Method and Looking Ahead

So, when is the frequency sampling method useful?

  • Pros: It's conceptually straightforward and provides perfect accuracy at the specified frequency sample points. This can be ideal for applications where performance at specific frequencies is critical (e.g., building a filter to reject a specific set of harmonics).

  • Cons: For general-purpose selective filters (like low-pass or band-pass), the performance between sample points is often poor due to time-domain aliasing. It typically yields much worse stopband attenuation than a filter designed with the window method using the same number of coefficients.

An important extension to this method involves not making the transition from passband to stopband so abrupt. Instead of samples being strictly 1 or 0, one or two samples in the transition band can be set to values between 0 and 1. By carefully optimizing the values of these transition samples, the stopband ripple can be significantly reduced. This idea of optimizing parameters to minimize error is a key concept that leads to more advanced design techniques.


Conclusion

In this lesson, we explored the frequency sampling method, which offers a distinct alternative to the windowing technique for FIR filter design.

Key Takeaways:

  • The frequency sampling method designs a filter by sampling the desired frequency response and then using the IDFT to compute the filter coefficients.
  • Mathematically, it can be understood as a Riemann sum approximation of the continuous inverse DTFT integral.
  • Its primary limitation is time-domain aliasing, which arises from sampling in the frequency domain and results in poor performance (ripple, low attenuation) between the sample points.
  • The method is most effective when the desired response is only critical at specific, uniformly spaced frequencies.

Preview of the Next Lesson:

Both the window and frequency sampling methods are intuitive but are ultimately sub-optimal. They do not produce the best possible filter for a given length and set of specifications. This raises a natural question: Can we design a filter that has the absolute minimum possible error, distributed evenly across the passband and stopband? The answer is yes. This leads us to the concept of "optimal" filters, and in our next lesson, we will describe the principles of the celebrated Parks-McClellan algorithm, which is used to design such optimal equiripple FIR filters.