Teaching FIR Filter Design Using the Digital Filter Design Toolkit (Windowing)

Publish Date: Sep 06, 2006 | 28 Ratings | 3.68 out of 5 |  PDF

Overview

With NI LabVIEW and the Digital Filter Design Toolkit, you can easily teach fundamental digital signal processing and filtering concepts. Working within the LabVIEW graphical development environment, students can focus on understanding filtering concepts rather than programming implementation. This document leads you through an example that uses the Digital Filter Design Toolkit to solve a common digital filter design problem involving FIR filter design and windowing effects.

Table of Contents

  1. Problem Description
  2. Solution
  3. Implementing the Filters in LabVIEW
  4. Variations on the Solution Presentation

1. Problem Description

Design a length-23 linear-phase FIR lowpass filter to approximate an ideal response with a passband edge of 0.3p. Design a filter using each of the following windows:
  1. Rectangular
  2. Triangular
  3. Hanning
  4. Hamming
  5. Blackman

Plot the impulse response, magnitude response, and zero-pole locations of these filters. Compare the characteristics of the magnitude response.
See Also:
This problem is adopted from a project posted by Prof. Stan Reeves at Auburn University

Back to Top

2. Solution


This problem examines the windowing methods for FIR filter design. Refer to the FIR Windowed Filter Design VI example link below to download a program written in LabVIEW 7.1 that provides a solution to this problem. Open the VI and run it to view the impulse response, magnitude response, and the zero-pole locations. Change the window type to any of the 11 available window types and observe the corresponding changes in the filter response.

For example, the following figures display the filter responses when you select Rectangular (None) and Hanning as the window type.

Figure 1. Rectangular Window (that is, no windowing techniques are applied to the filter design)


Figure 2. Hanning Window

Back to Top

3. Implementing the Filters in LabVIEW

1. Open a blank VI in LabVIEW. Right-click the block diagram to open the Functions palette. Click the All Functions palette and then locate the Digital Filter Design Toolkit palette.

Note: The LabVIEW palettes shown in the following figures are configured to display the palette icon and text. By default, LabVIEW displays only the palette icon. You can change the palette configuration to display both icons and text by selecting Tools»Options in LabVIEW, selecting Controls/Functions Palettes from the top pull-down menu in the Options dialog box, and selecting Icons and Text in the Format list. Refer to the Getting Started with LabVIEW manual, linked below, for more information about working in LabVIEW.

Figure 3. Functions Palette


Figure 4. Digital Filter Design Toolkit Palette Icon


2. Because you want to design an FIR filter, open the Filter Design palette and then the Advanced FIR Filter Design palette, as shown in the following figures.

Figure 5. Digital Filter Design Palette


Figure 6. Filter Design Palette

3. Because you are exploring concepts related to windowing in FIR filter design, select the DFD Windowed FIR Design VI from the Advanced FIR Filter Design palette, as shown in the following figure, and place it on the block diagram.

Figure 7. Advanced FIR Filter Design Palette

4. Examine the DFD Windowed FIR Design VI connector pane, as shown in the following figure, to learn more about the inputs and outputs of this VI.

Figure 8. DFD Windowed FIR Design VI Connector Pane

5. Complete the following steps to set the inputs to the DFD Windowed FIR Design VI. When you are complete, your block diagram should resemble the block diagram in the following figure.

Figure 9. Inputs to the DFD Windowed FIR Design VI to Design the Filter

    1. Right-click the filter type input, and select Create»Constant from the shortcut menu to create a constant. Set the constant to Lowpass.
    2. Because you need a filter length of 23, wire a constant to the order output and set it to 23.
    3. To simplify the problem, set the sampling frequency input, fs, to 1 Hz.
    4. The high cutoff freq: fh input is used only for bandpass filters so you can ignore it for this example.
    5. Wire a constant set to 0.15 to the low cutoff freq: fl input. The cut-off frequency is 0.3p. By definition p = (Fs/2). Hence, the cut-off frequency is 0.3 p = (0.3 Fs)/2 = (0.3 * 1)/2 = 0.15.
    6. Right-click the window input and select Create»Control from the shortcut menu. You can design a variety of windowed FIR filters with the DFD Windowed FIR Design VI. The window input determines the type of window used. Below is a list of windows this VI offers. You can find this information in the LabVIEW Help by selecting Help»VI, Function, & How-To Help and selecting DFD Windowed FIR Design in the Index.

Figure 10. Window Options for the DFD Windowed FIR Design VI

6. Now that you have designed the filter, find the DFD Filter Analysis Express VI, located on the Filter Analysis palette as shown in the following figure, and place it on the block diagram to analyze the filter you created. Express VIs are interactive VIs with configuration dialog boxes compared to standard VIs, which are modularized VIs whose input parameters you wire to the VI.

Figure 10. Filter Analysis Palette

7. When you place an Express VI on the block diagram, the configuration dialog box appears. Because you want to analyze only the impulse response, magnitude response, and the pole-zero locations, remove the checkmarks from the Show step response, Show phase response, and Show group delay checkboxes, as shown in the following figure.

Figure 11. Configuration Dialog Box for the DFD Filter Analysis Express VI

8. Observe that you have an option to display the graphs on a linear scale or on a dB scale. Select dB for this problem as this scale can better display the change in value over a large range of magnitudes. Click the OK button to close the configuration dialog box.

9. Wire the filter out output of the DFD Windowed FIR Design VI to the filter in input of the DFD Filter Analysis Express VI.

10. Right-click the magnitude, Z Plane, and impulse outputs of the DFD Filter Analysis Express VI and select Create»Graph Indicator or Create»Indicator from the shortcut menu for each.

Your final block diagram should resemble the following block diagram.

Figure 12. Final Block Diagram to Design and Analyze the Filter
See Also:
Getting Started with LabVIEW

Back to Top

4. Variations on the Solution Presentation

You can show the filter responses of multiple window types on the same graph or front panel for side-by-side comparison, as shown in the following figures. Refer to the example linked below to experiment with the VIs.

Figure 13. Filter Responses on Overlaid Plots


Figure 14. Filter Responses on a Single Array of Plots
You can resize the array to display the filter response of more than one consecutive window type at the same time.


Figure 15. Two Arrays Display the Plots
This display enables you to arbitrarily compare the filter response of any two window types.
See Also:
Windowed FIR Filter Design Example VI
Getting Started With LabVIEW

Back to Top

Bookmark & Share

Ratings

Rate this document

Answered Your Question?
Yes No

Submit