Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Optimal FIR Filter

0 ratings | 0.00 out of 5
Print

Overview

This example demonstrates that the Parks-McClellan method always gives an optimal response when compared with the Linear Programming approximation. The user can design a filter by setting band parameters of a desired frequency response. The user can also set the order, or number of taps, used in the FIR implementation. The output graph shows both the Parks-McClellan method and the Linear Programming approximation.

Front Panel

This example requires the Full or Professional version of LabVIEW and is included as a shipping example. Download the LabVIEW Evaluation to try this example on your computer, or visit the LabVIEW Online Evaluation to use LabVIEW without downloading any software. To run this example, open LabVIEW and navigate to Help » Find Examples... » Analyzing and Processing Signals » Filtering and Conditioning

Background                                       

Finite impulse response (FIR) filters are digital filters that operate only on current and past input values and are the simplest filters to design. FIR filters also are known as non-recursive filters, convolution filters, and moving average (MA) filters. FIR filters perform a convolution of the filter coefficients with a sequence of input values and produce an equally numbered sequence of output values.

FIR filters have the following characteristics:

  • FIR filters can achieve linear phase because of filter coefficient symmetry in the realization.
  • FIR filters are always stable.
  • FIR filters allow you to filter signals using the convolution. Therefore, you generally can associate a delay with the output sequence, as shown in the following equation:

delay = (n – 1)/2

 

where n is the number of FIR filter coefficients.

Designing Optimum FIR Filters Using the Parks-McClellan Algorithm

The Parks-McClellan algorithm, or Remez Exchange, uses an iterative technique based on an error criterion to design FIR filter coefficients. You can use the Parks-McClellan algorithm to design optimum, linear-phase, FIR filter coefficients. Filters you design with the Parks-McClellan algorithm are optimal because they minimize the maximum error between the actual magnitude response of the filter and the ideal magnitude response of the filter.

Designing optimum FIR filters reduces adverse effects at the cut-off frequencies. Designing optimum FIR filters also offers more control over the approximation errors in different frequency bands than other FIR filter design techniques, such as designing FIR filters by windowing, which provides no control over the approximation errors in different frequency bands.

Optimum FIR filters you design using the Parks-McClellan algorithm have the following characteristics:

  • A magnitude response with the weighted ripple evenly distributed over the passband and stopband
  • A sharp transition band

FIR filters you design using the Parks-McClellan algorithm have an optimal response. However, the design process is complex, requires a large amount of computational resources, and is much longer than designing FIR filters by windowing.

Designing Equiripple FIR Filters Using the Parks-McClellan Algorithm

You can use the Parks-McClellan algorithm to design equiripple FIR filters. Equiripple design equally weights the passband and stopband ripple and produces filters with a linear phase characteristic.

You must specify the following filter characteristics to design an equiripple FIR filter:

  • Cut-off frequency
  • Number of taps
  • Filter type, such as lowpass, highpass, bandpass, or bandstop
  • Pass frequency
  • Stop frequency

The cut-off frequency for equiripple filters specifies the edge of the passband, the stopband, or both. The ripple in the passband and stopband of equiripple filters causes the following magnitude responses:

  • Passband—a magnitude response greater than or equal to 1
  • Stopband—a magnitude response less than or equal to the stopband attenuation

For example, if you specify a lowpass filter, the passband cut-off frequency is the highest frequency for which the passband conditions are true. Similarly, the stopband cut-off frequency is the lowest frequency for which the stopband conditions are true.

Demonstration

1. Set the band parameters to the following to create a band stop filter.

Note: Each band parameter has to be spaced at least 0.02 normalized frequency units away from each other to allow for a transition region at cut-offs.

2. Press the Calculation button to observe how well the Parks-McClellan operation performs at the cut-offs compared to the Linear Programming approximation.

Related Links

 

0 ratings | 0.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).