# Connexions

You are here: Home » Content » Digital Filter Design » Parks-McClellan FIR Filter Design

### 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?

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

#### In these lenses

• SigProc

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

Inside Collection (Course):

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

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

## Exercise 1

Must there be a transition band?

## 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?

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

## 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!

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.

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.

## Content actions

PDF | EPUB (?)

### What is an EPUB file?

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

PDF | EPUB (?)

### What is an EPUB file?

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

#### 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?

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?

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

### Reuse / Edit:

Reuse or edit collection (?)

#### Check out and edit

If you have permission to edit this content, using the "Reuse / Edit" action will allow you to check the content out into your Personal Workspace or a shared Workgroup and then make your edits.

#### Derive a copy

If you don't have permission to edit the content, you can still use "Reuse / Edit" to adapt the content by creating a derived copy of it and then editing and publishing the copy.

| Reuse or edit module (?)

#### Check out and edit

If you have permission to edit this content, using the "Reuse / Edit" action will allow you to check the content out into your Personal Workspace or a shared Workgroup and then make your edits.

#### Derive a copy

If you don't have permission to edit the content, you can still use "Reuse / Edit" to adapt the content by creating a derived copy of it and then editing and publishing the copy.