Skip to content Skip to navigation

OpenStax_CNX

You are here: Home » Content » DSP Laboratory: IIR Notch Filter Design

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

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

What is in a lens?

Lens makers point to 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 member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • NSF Partnership display tagshide tags

    This module is included inLens: NSF Partnership in Signal Processing
    By: Sidney BurrusAs a part of collection: "Fundamentals of Digital Signal Processing Lab"

    Click the "NSF Partnership" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

  • National Instruments display tagshide tags

    This module is included in aLens by: National InstrumentsAs a part of collection: "Fundamentals of Digital Signal Processing Lab"

    Comments:

    "The purpose of this course, EE 453 at Penn State University, is to familiarize students with DSP development by examining sampling, analysis, and reconstruction of continuous-time signals. […]"

    Click the "National Instruments" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Also in these lenses

  • Lens for Engineering

    This module is included inLens: Lens for Engineering
    By: Sidney Burrus

    Click the "Lens for Engineering" link to see all content selected in this lens.

  • NI Signal Processing display tagshide tags

    This module is included inLens: Digital Signal Processing with NI LabVIEW and the National Instruments Platform
    By: Sam ShearmanAs a part of collection: "Fundamentals of Digital Signal Processing Lab"

    Comments:

    "Lab material that explores signal processing concepts using National Instruments LabVIEW DSP."

    Click the "NI Signal Processing" link to see all content selected in this lens.

    Click the tag icon tag icon to display tags associated with this content.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.
 

DSP Laboratory: IIR Notch Filter Design

Module by: Erik Luther. E-mail the author

Summary: The purpose of this lab is to examine IIR filter design/implementation using LabVIEW DSP. Particular attention is drawn to the comparison between theoretical filter characteristics and actual filter performance. In this lab, it is assumed that the student is already familiar with the basic operation of LabVIEW DSP.

Notch IIR Filter Design

The purpose of this lab is to examine IIR filter design/implementation using LabVIEW DSP. Particular attention is drawn to the comparison between theoretical filter characteristics and actual filter performance. In this lab, it is assumed that the student is already familiar with the basic operation of LabVIEW DSP.

Create a VI for Plotting Time and Frequency Domain Data

  1. Open Surround Mixer, a program which controls the input/output operation of the sound card. Make sure that the Wave/mp3 and Line-in volumes are set to approximately 75%. Make sure that all source buttons are muted for now. Keep the Surround Mixer open throughout the lab. You will be selecting various inputs (Wave and Line-in) throughout the lab.
  2. Start LabVIEW Embedded Edition (Start»All Programs»LabVIEW Embedded Edition) and open a blank VI (Virtual Instrument).
    Figure 1: Pass-Through VI
    Figure 1 (Graphic1)
  3. We will build the VI whose Block Diagram is shown in Figure
    • Switch execution target to your hardware by going to Operate»Switch Execution Target in LabVIEW Embedded.
    • Go to the Block Diagram of the blank VI, navigate the function palette to the Analog Input, click and drop an analog input element on the Block Diagram. It is located under Functions»Elemental IO»Analog Input. See Figure 2.
      Figure 2: Elemental I/O sub palette
      Figure 2 (Graphic2)
    • Double-click on the Analog Input elemental I/O for configuration. In the configuration window, select the “General” tab. Click on the drop down under resource and select 2 channel Multiple Samples. On the Configuration tab, set the Sampling Rate to 16000 Hz and the Framesize to 256. Click “OK” to close the window.
    • Drop an Add function located on the Numeric sub palette of the Functions palette: Functions»Numeric»Add.
    • Drop an Analog Output elemental I/O. Functions»Elemental I/O»Analog Output. Double click on the Analog Output you just dropped on the Block Diagram and set the Sample Rate to 16000 Hz on the Configuration tab. Click “OK” to close.
    • Drop a “Spectral Measurement” Express VI on the block diagram. Functions»Signal Processing»Frequency Domain»Spectral Measurements. This VI will allow us to build the power spectrum of the sound signal. Double click on the Spectral Measurements Express VI to open its configuration window. In the window, select Power Spectrum for Spectral Measurements and dB for results (See Figure)
    • Click “OK” to validate the configuration.
      Figure 3: Spectral Measurements Configuration
      Figure 3 (Graphic3)
    • Now let’s switch to the Front Panel (Windows»Show Front Panel) and drop two Waveform Graphs. The Waveform Graph is located on the Graph Sub palette: Controls»Graphs»Waveform Graph. Name one “Time Domain” and the other “Power Spectrum.” Do not add the stop button yet.
      Figure 4: VI Front Panel
      Figure 4 (Graphic4)
    • Let’s switch back to the Block Diagram and wire everything already on the diagram as shown in Figure 1.
    • Select the while loop from Functions»Structures»While Loop, click and drag to enclose everything on the Block Diagram within the loop. You Block Diagram should now be similar to the one in Figure 1 and the Front Panel similar to the one in Figure 4.

    Note:

    This setup is similar to that found in the “DSP Laboratory: Time and Frequency Displays” Module except that the Left and Right channels are being combined into a single channel.
  4. In Surround Mixer activate the Wave/mp3 source and put a CD into the computer’s CD-ROM drive. Run the Windows Media Player program in the EE 453 folder to start the CD. Finally, press the Run icon and you should hear your music through the headphones. If there is distortion/clipping (due to the volume being too high), adjust the CD volume on the Surround Mixer to lower the volume until the clipping stops. Now adjust the two displays to make one a time-domain display and the other a frequency-domain display. Remember how to set/unset the automatic scaling on the displays. It is usually best to use Auto scaling on the frequency-domain display but not the time-domain display.
  5. Once you have verified that everything is working properly, stop the CD, then stop the LabVIEW program (but don’t exit LabVIEW).
  6. 11. Save the VI by selecting File»Save As. Make sure to save the file in your personal directory -- Desktop\ee 453\<folder name>. You can give the file any name you want (such as lab2setup).

Notch Filter

Now we’re going to add some noise to the music and then filter it out. The first type of noise we’re going to add is a single frequency sinusoidal noise. As you know from class, the best filter to use for this type of filter is a simple notch filter.

  1. Using the BNC to RCA adapter, connect the long black cable coming from the computer soundcard (the line-in cable) to the FUNC OUT output of the function generator.
  2. Turn on the function generator and set it up to generate a 1000 Hz, 0.2 V sine wave. Don’t forget to activate the signal by pressing the OUT/ON button on the function generator, setting its value to 1, and then pressing the EXEC button.
  3. In Surround Mixer, activate the Line-in input. Run the program in LabVIEW and you should hear an annoying 1000 Hz. tone. Adjust the volume of the Line-in source in Surround Mixer so that the output sine wave amplitude is close to 5000 units.
  4. Now restart the CD. You should hear the music, but it will be corrupted with a very annoying sinusoidal tone. (Depending on your music selection, you may possibly need to increase the amplitude of the sinusoidal noise so that it can be heard over the music). Examine both the time- and frequency-domain displays of the signal + noise. Stop the program before the noise drives you crazy.
  5. Add a Biquad VI from Functions»Signal Processing»Filters»Biquad.vi . This block allows you to specify the coefficients of a generic 2nd-order digital filter. A biquad is just a particular configuration for a 2nd-order digital filter.
  6. Determine the transfer function of the notch filter needed to remove the 1000 Hz. noise. Use a value of alpha = 0.9.
  7. Double click on the Biquad VI and enter the coefficient values. Insert the Biquad VI between the output of the Add function and the inputs to the Analog Output elemental I/O (see Figure 5 for the modified Block Diagram). (You’ll need to break the existing connections first).
  8. Re-run the program and take notice of whether the filter effectively removes the noise without removing too much of the music signal. Take special note of the frequency spectrum of the filtered signal + noise.
Figure 5: Modified Block Diagram with the Biquad VI
Figure 5 (Graphic5)

Answer These Questions

Exercise 1

Calculate the transfer function of the notch filter needed to remove the sinusoidal noise. Show your work.

Exercise 2

Does this filter seem to remove much of the music signal along with the noise? Explain why or why not.

  • To see how sensitive this filter is, increase the frequency of the sinusoidal noise in increments of 10 Hz until the filter no longer seems to be removing the sinusoidal noise adequately. This is somewhat subjective and may also depend on the music that you’re combining with the sinusoidal noise.

Answer These Questions

Exercise 3

At what sinusoidal noise frequency does this filter no longer effectively remove the sinusoidal tone from the music?

  • Now turn off the music so that you only have the sinusoidal noise going through the system. Sweep the sine wave frequency through a range from about 500-3000 Hz. and note how the tone cuts out in the vicinity of 1000 Hz. Next determine the smallest frequency > 1000 Hz. at which the output signal appears to be at full amplitude.

Answer These Questions

Exercise 4

At what sinusoidal noise frequency does the filter no longer attenuate the sine wave at all?

  • Using alpha = 0.5, repeat from step Don’t forget to turn your music back on and to reset your sinusoid to 1000 Hz. before starting the test. Also, use the same music as you did before. Otherwise, you may not be able to compare the 2 different filters accurately.

Answer These Questions

Exercise 5

Using this new alpha vaue, calculate the transfer function of the notch filter needed to remove the sinusoidal noise. Show your work below.

Exercise 6

What effect did decreasing alpha have on the quality of the remaining music? Explain.

Exercise 7

Using this new alpha, at what sinusoidal noise frequency did the filter stop removing the sinusoidal tone from the music?

Exercise 8

At what sinusoidal noise frequency does the filter no longer attenuate the sine wave at all?

Exercise 9

Based on your observation, does decreasing  seem to make the filter remove a larger or smaller range of sinusoidal frequencies? Explain why this is so.

When done with this part of the lab, stop the program, remove the notch filter block, and save the VI. This VI is used in other labs.

Content actions

Download module as:

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

Downloading to a reading device

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

| More downloads ...

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

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

What is in a lens?

Lens makers point to 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 member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks