Skip to content Skip to navigation

Connexions

You are here: Home » Content » FIR Filter Example

Navigation

Content Actions

  • Download module PDF
  • Add to ...
    Add the module to:
    • My Favorites
    • A lens
    • An external social bookmarking service
    • My Favorites (What is 'My Favorites'?)
      'My Favorites' is a special kind of lens which you can use to bookmark modules and collections directly in Connexions. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need a Connexions account to use 'My Favorites'.
    • A lens (What is a lens?)

      Definition of a lens

      Lenses

      A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

      What is in a lens?

      Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

      Who can create a lens?

      Any individual Connexions member, a community, or a respected organization.

    • External bookmarks
  • E-mail the author

Recently Viewed

This feature requires Javascript to be enabled.

FIR Filter Example

Module by: Don Johnson

Summary: An example of using a Finite Impulse Response filter.

Example 1

We want to lowpass filter a signal that contains a sinusoid and a significant amount of noise. Figure 1 shows a portion of this signal's waveform. If it weren't for the overlaid sinusoid, discerning the sine wave in the signal is virtually impossible. One of the primary applications of linear filters is noise removal: preserve the signal by matching filter's passband with the signal's spectrum and greatly reduce all other frequency components that may be present in the noisy signal.

Figure 1: The noisy input signal is sectioned into length-48 frames, each of which is filtered using frequency-domain techniques. Each filtered section is added to other outputs that overlap to create the signal equivalent to having filtered the entire input. The sinusoidal component of the signal is shown as the red dashed line.
Figure 1 (sig25.png)

A smart Rice engineer has selected a FIR filter having a unit-sample response corresponding a period-17 sinusoid: hn=1-cos2πn+11718 h n 1 2 n 1 17 18 , n016 n 0 16 , which makes q=16 q 16 . Its frequency response (determined by computing the discrete Fourier transform) is shown in Figure 2. To apply, we can select the length of each section so that the frequency-domain filtering approach is maximally efficient: Choose the section length N x N x so that N x +q N x q is a power of two. To use a length-64 FFT, each section must be 48 samples long. Filtering with the difference equation would require 33 computations per output while the frequency domain requires a little over 16; this frequency-domain implementation is over twice as fast! Figure 1 shows how frequency-domain filtering works.

Figure 2: The figure shows the unit-sample response of a length-17 Hanning filter on the left and the frequency response on the right. This filter functions as a lowpass filter having a cutoff frequency of about 0.1.
Figure 2 (sig24.png)

We note that the noise has been dramatically reduced, with a sinusoid now clearly visible in the filtered output. Some residual noise remains because noise components within the filter's passband appear in the output as well as the signal.

Exercise 1

Note that when compared to the input signal's sinusoidal component, the output's sinusoidal component seems to be delayed. What is the source of this delay? Can it be removed?

Solution 1

The delay is not computational delay here—the plot shows the first output value is aligned with the filter's first input—although in real systems this is an important consideration. Rather, the delay is due to the filter's phase shift: A phase-shifted sinusoid is equivalent to a time-delayed one: cos2πfn-φ=cos2πfn-φ2πf 2 f n φ 2 f n φ 2 f . All filters have phase shifts. This delay could be removed if the filter introduced no phase shift. Such filters do not exist in analog form, but digital ones can be programmed, but not in real time. Doing so would require the output to emerge before the input arrives!

Comments, questions, feedback, criticisms?

Send feedback