Skip to content Skip to navigation Skip to collection information

OpenStax_CNX

You are here: Home » Content » Digital Signal Processing: A User's Guide » Parks-McClellan FIR Filter Design

Navigation

Table of Contents

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 ...

In these lenses

  • SigProc display tagshide tags

    This module is included inLens: Signal Processing
    By: Daniel McKennaAs a part of collection: "Fundamentals of Signal Processing"

    Click the "SigProc" 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.
 

Parks-McClellan FIR Filter Design

Module by: Douglas L. Jones. E-mail the author

The approximation tolerances for a filter are very often given in terms of the maximum, or worst-case, deviation within frequency bands. For example, we might wish a lowpass filter in a (16-bit) CD player to have no more than 12 1 2 -bit deviation in the pass and stop bands.

Hω={11217|Hω|1+1217  if  |ω| ω p 1217|Hω|  if   ω s |ω|π H ω 1 1 2 17 H ω 1 1 2 17 ω ω p 1 2 17 H ω ω s ω

The Parks-McClellan filter design method efficiently designs linear-phase FIR filters that are optimal in terms of worst-case (minimax) error. Typically, we would like to have the shortest-length filter achieving these specifications. Figure Figure 1 illustrates the amplitude frequency response of such a filter.

Figure 1: The black boxes on the left and right are the passbands, the black boxes in the middle represent the stop band, and the space between the boxes are the transition bands. Note that overshoots may be allowed in the transition bands.
Figure 1 (fig1.png)

Exercise 1

Must there be a transition band?

Solution

Yes, when the desired response is discontinuous. Since the frequency response of a finite-length filter must be continuous, without a transition band the worst-case error could be no less than half the discontinuity.

Formal Statement of the L-∞ (Minimax) Design Problem

For a given filter length (MM) and type (odd length, symmetric, linear phase, for example), and a relative error weighting function Wω W ω , find the filter coefficients minimizing the maximum error argminhargmaxωF|Eω|=argminhEω h ω F E ω h E ω where Eω=Wω( H d ωHω) E ω W ω H d ω H ω and FF is a compact subset of ω 0 π ω 0 (i.e., all ωω in the passbands and stop bands).

Note:

Typically, we would often rather specify Eωδ E ω δ and minimize over MM and hh; however, the design techniques minimize δδ for a given MM. One then repeats the design procedure for different MM until the minimum MM satisfying the requirements is found.
We will discuss in detail the design only of odd-length symmetric linear-phase FIR filters. Even-length and anti-symmetric linear phase FIR filters are essentially the same except for a slightly different implicit weighting function. For arbitrary phase, exactly optimal design procedures have only recently been developed (1990).

Outline of L-∞ Filter Design

The Parks-McClellan method adopts an indirect method for finding the minimax-optimal filter coefficients.

  1. Using results from Approximation Theory, simple conditions for determining whether a given filter is L L (minimax) optimal are found.
  2. An iterative method for finding a filter which satisfies these conditions (and which is thus optimal) is developed.

That is, the L L filter design problem is actually solved indirectly.

Conditions for L-∞ Optimality of a Linear-phase FIR Filter

All conditions are based on Chebyshev's "Alternation Theorem," a mathematical fact from polynomial approximation theory.

Alternation Theorem

Let FF be a compact subset on the real axis xx, and let Px P x be and LLth-order polynomial Px= k =0L a k xk P x k L 0 a k x k Also, let Dx D x be a desired function of xx that is continuous on FF, and Wx W x a positive, continuous weighting function on FF. Define the error Ex E x on FF as Ex=Wx(DxPx) E x W x D x P x and Ex=argmaxxF|Ex| E x x F E x A necessary and sufficient condition that Px P x is the unique LLth-order polynomial minimizing Ex E x is that Ex E x exhibits at least L+2 L 2 "alternations;" that is, there must exist at least L+2 L 2 values of xx, x k F x k F , k=01L+1 k 0 1 L 1 , such that x 0 < x 1 << x L + 2 x 0 x 1 x L + 2 and such that E x k =E x k + 1 =±E E x k E x k + 1 ± E

Exercise 2

What does this have to do with linear-phase filter design?

Solution

It's the same problem! To show that, consider an odd-length, symmetric linear phase filter.

Hω= n =0M1hne(jωn)=e(jωM12)(hM12+2 n =1LhM12ncosωn) H ω n M 1 0 h n ω n ω M 1 2 h M 1 2 2 n L 1 h M 1 2 n ω n
(1)
Aω=hL+2 n =1LhLncosωn A ω h L 2 n L 1 h L n ω n
(2)

Where LM12 L M 1 2 .

Using trigonometric identities (such as cosnα=2cos(n1)αcosαcos(n2)α n α 2 n 1 α α n 2 α ), we can rewrite Aω A ω as Aω=hL+2 n =1LhLncosωn= k =0L α k coskω A ω h L 2 n L 1 h L n ω n k L 0 α k ω k where the α k α k are related to the hn h n by a linear transformation. Now, let x=cosω x ω . This is a one-to-one mapping from x -1 1 x -1 1 onto ω 0 π ω 0 . Thus Aω A ω is an LLth-order polynomial in x=cosω x ω !

implication:
The alternation theorem holds for the L L filter design problem, too!
Therefore, to determine whether or not a length-MM, odd-length, symmetric linear-phase filter is optimal in an L L sense, simply count the alternations in Eω=Wω(Ad ωAω) Eω Wω Ad ω Aω in the pass and stop bands. If there are L+2=M+32 L2 M3 2 or more alternations, hnhn, 0nM10n M1 is the optimal filter!

Optimality Conditions for Even-length Symmetric Linear-phase Filters

For M M even, Aω= n =0LhLncosω(n+12) A ω n 0 L h L n ω n 1 2 where L=M21 L M 2 1 Using the trigonometric identity cosα+β=cosαβ+2cosαcosβ α β α β 2 α β to pull out the ω2 ω 2 term and then using the other trig identities, it can be shown that Aω A ω can be written as Aω=cosω2 k =0L α k coskω A ω ω 2 k 0 L α k ω k Again, this is a polynomial in x=cosω x ω , except for a weighting function out in front.

Eω=Wω( A d ωAω)=Wω( A d ωcosω2Pω)=Wωcosω2( A d ωcosω2Pω) E ω W ω A d ω A ω W ω A d ω ω 2 P ω W ω ω 2 A d ω ω 2 P ω
(3)
which implies
Ex= W ' x( A d ' xPx) E x W ' x A d ' x P x
(4)
where W ' x=Wcosx-1cos12cosx-1 W ' x W x 1 2 x and A d ' x= A d cosx-1cos12cosx-1 A d ' x A d x 1 2 x Again, this is a polynomial approximation problem, so the alternation theorem holds. If Eω E ω has at least L+2=M2+1 L 2 M 2 1 alternations, the even-length symmetric filter is optimal in an L L sense.

The prototypical filter design problem: W={1  if  |ω| ω p δ s δ p   if  | ω s ||ω| W 1 ω ω p δ s δ p ω s ω See Figure 2.

Figure 2
Figure 2 (fig2.png)

L-∞ Optimal Lowpass Filter Design Lemma

  1. The maximum possible number of alternations for a lowpass filter is L+3 L 3 : The proof is that the extrema of a polynomial occur only where the derivative is zero: Px x =0 x P x 0 . Since Px P x is an ( L - 1 ) ( L - 1 ) th-order polynomial, it can have at most L - 1 L - 1 zeros. However, the mapping x=cosω x ω implies that Aω ω =0 ω A ω 0 at ω=0 ω 0 and ω=π ω , for two more possible alternation points. Finally, the band edges can also be alternations, for a total of L1+2+2=L+3 L 1 2 2 L 3 possible alternations.
  2. There must be an alternation at either ω=0 ω 0 or ω=π ω .
  3. Alternations must occur at ω p ω p and ω s ω s . See Figure 2.
  4. The filter must be equiripple except at possibly ω=0 ω 0 or ω=π ω . Again see Figure 2.

Note:

The alternation theorem doesn't directly suggest a method for computing the optimal filter. It simply tells us how to recognize that a filter is optimal, or isn't optimal. What we need is an intelligent way of guessing the optimal filter coefficients.
In matrix form, these L+2 L 2 simultaneous equations become ( 1cos ω 0 cos2 ω 0 ...cosL ω 0 1W ω 0 1cos ω 1 cos2 ω 1 ...cosL ω 1 -1W ω 1 ... ... 1cos ω L + 1 cos2 ω L + 1 ...cosL ω L + 1 ±1W ω L + 1 )hLhL1h1h0δ= A d ω 0 A d ω 1 A d ω L + 1 1 ω 0 2 ω 0 ... L ω 0 1 W ω 0 1 ω 1 2 ω 1 ... L ω 1 -1 W ω 1 ... ... 1 ω L + 1 2 ω L + 1 ... L ω L + 1 ± 1 W ω L + 1 h L h L 1 h 1 h 0 δ A d ω 0 A d ω 1 A d ω L + 1 or Whδ= A d W h δ A d So, for the given set of L+2 L 2 extremal frequencies, we can solve for h h and δ δ via hδT=W-1 A d h δ W A d . Using the FFT, we can compute Aω A ω of hn h n , on a dense set of frequencies. If the old ω k ω k are, in fact the extremal locations of Aω A ω , then the alternation theorem is satisfied and hn h n is optimal. If not, repeat the process with the new extremal locations.

Computational Cost

OL3 O L 3 for the matrix inverse and Nlog 2 N N 2 N for the FFT ( N32L N 32 L , typically), per iteration!

This method is expensive computationally due to the matrix inverse.

A more efficient variation of this method was developed by Parks and McClellan (1972), and is based on the Remez exchange algorithm. To understand the Remez exchange algorithm, we first need to understand Lagrange Interpoloation.

Now Aω A ω is an L Lth-order polynomial in x=cosω x ω , so Lagrange interpolation can be used to exactly compute Aω A ω from L+1 L 1 samples of A ω k A ω k , k=012...L k 0 1 2 ... L .

Thus, given a set of extremal frequencies and knowing δ δ, samples of the amplitude response Aω A ω can be computed directly from the

A ω k =1k(1)W ω k δ+ A d ω k A ω k 1 k 1 W ω k δ A d ω k
(5)
without solving for the filter coefficients!

This leads to computational savings!

Note that Equation 5 is a set of L+2 L 2 simultaneous equations, which can be solved for δ δ to obtain (Rabiner, 1975)

δ= k =0L+1 γ k A d ω k k =0L+11k(1) γ k W ω k δ k 0 L 1 γ k A d ω k k 0 L 1 1 k 1 γ k W ω k
(6)
where γ k = i =ik,0L+11cos ω k cos ω i γ k i i k 0 L 1 1 ω k ω i The result is the Parks-McClellan FIR filter design method, which is simply an application of the Remez exchange algorithm to the filter design problem. See Figure 3.

Figure 3: The initial guess of extremal frequencies is usually equally spaced in the band. Computing δ δ costs OL2 O L 2 . Using Lagrange interpolation costs O16LLO16L2 O 16 L L O 16 L 2 . Computing hn h n costs OL3 O L 3 , but it is only done once!
Figure 3 (fig3.png)

The cost per iteration is O16L2 O 16 L 2 , as opposed to OL3 O L 3 ; much more efficient for large L L. Can also interpolate to DFT sample frequencies, take inverse FFT to get corresponding filter coefficients, and zeropad and take longer FFT to efficiently interpolate.

Collection Navigation

Content actions

Download:

Collection 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 ...

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:

Collection 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

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