computer-aided design of -...

22
1 1 Copyright © 2005, S. K. Mitra Computer Computer- Aided Design of Aided Design of Digital Filters Digital Filters The FIR filter design techniques discussed so far can be easily implemented on a computer In addition, there are a number of FIR filter design algorithms that rely on some type of optimization techniques that are used to minimize the error between the desired frequency response and that of the computer-generated filter 2 Copyright © 2005, S. K. Mitra Computer Computer- Aided Design of Aided Design of Digital Filters Digital Filters Basic idea behind the computer-based iterative technique • Let denote the frequency response of the digital filter H(z) to be designed approximating the desired frequency response , given as a piecewise linear function of , in some sense ) ( ω j e H ω ) ( ω j e D 3 Copyright © 2005, S. K. Mitra Computer Computer- Aided Design of Aided Design of Digital Filters Digital Filters • Objective - Determine iteratively the coefficients of H(z) so that the difference between between and over closed subintervals of is minimized This difference usually specified as a weighted error function where is some user-specified weighting function ) ( ω j e H ) ( ω j e D π ω 0 )] ( ) ( )[ ( ) ( ω ω ω = ω j j j e D e H e W E ) ( ω j e W 4 Copyright © 2005, S. K. Mitra Computer Computer- Aided Design of Aided Design of Digital Filters Digital Filters Chebyshev or minimax criterion - Minimizes the peak absolute value of the weighted error: where R is the set of disjoint frequency bands in the range , on which is defined ) ( max ω = ε ω E R π ω 0 ) ( ω j e D 5 Copyright © 2005, S. K. Mitra Design of Design of Equiripple Equiripple Linear Linear- Phase FIR Filters Phase FIR Filters The linear-phase FIR filter obtained by minimizing the peak absolute value of is usually called the equiripple FIR filter • After is minimized, the weighted error function E(ω) exhibits an equiripple behavior in the frequency range R ε ) ( max ω ε ω E R = 6 Copyright © 2005, S. K. Mitra Design of Design of Equiripple Equiripple Linear Linear- Phase FIR Filters Phase FIR Filters The general form of frequency response of a causal linear-phase FIR filter of length 2M+1: where the amplitude response is a real function of Weighted error function is given by where is the desired amplitude response and is a positive weighting function ) ( ) ( ω = β ω ω H e e e H j jM j ( ) (ω H ( ω )] ( ) ( )[ ( ) ( ω ω ω = ω D H W ( ) (ω D ) (ω W E

Upload: others

Post on 21-Dec-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

1

1Copyright © 2005, S. K. Mitra

ComputerComputer--Aided Design of Aided Design of Digital FiltersDigital Filters

• The FIR filter design techniques discussed so far can be easily implemented on a computer

• In addition, there are a number of FIR filter design algorithms that rely on some type of optimization techniques that are used to minimize the error between the desired frequency response and that of the computer-generated filter

2Copyright © 2005, S. K. Mitra

ComputerComputer--Aided Design of Aided Design of Digital FiltersDigital Filters

• Basic idea behind the computer-based iterative technique

• Let denote the frequency response of the digital filter H(z) to be designed approximating the desired frequency response , given as a piecewise linear function of , in some sense

)( ωjeH

ω)( ωjeD

3Copyright © 2005, S. K. Mitra

ComputerComputer--Aided Design of Aided Design of Digital FiltersDigital Filters

• Objective - Determine iteratively the coefficients of H(z) so that the difference between between and over closed subintervals of is minimized

• This difference usually specified as a weighted error function

where is some user-specified weighting function

)( ωjeH )( ωjeDπ≤ω≤0

)]()()[()( ωωω −=ω jjj eDeHeWE)( ωjeW

4Copyright © 2005, S. K. Mitra

ComputerComputer--Aided Design of Aided Design of Digital FiltersDigital Filters

• Chebyshev or minimax criterion -Minimizes the peak absolute value of the weighted error:

where R is the set of disjoint frequency bands in the range , on which is defined

)(max ω=ε∈ωE

R

π≤ω≤0 )( ωjeD

5Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• The linear-phase FIR filter obtained by minimizing the peak absolute value of

is usually called the equiripple FIR filter• After is minimized, the weighted error

function E(ω) exhibits an equiripplebehavior in the frequency range R

ε

)(max ωεω

ER∈

=

6Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• The general form of frequency response of a causal linear-phase FIR filter of length 2M+1:

where the amplitude response is a real function of

• Weighted error function is given by

where is the desired amplitude response and is a positive weighting function

)()( ω= βω−ω HeeeH jjMj (

)(ωH(

ω

)]()()[()( ω−ωω=ω DHW(

)(ωD)(ωW

E

2

7Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• Parks-McClellan Algorithm - Based on iteratively adjusting the coefficients of until the peak absolute value of E(ω) is minimized

• If peak absolute value of E(ω) in a band is , then the absolute error

satisfies

)(ωH(

bao

WDH ω≤ω≤ω

ωε≤ω−ω ,

)()()(

(

ba ω≤ω≤ω oε

8Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• For filter design,

• is required to satisfy the above desired response with a ripple of in the passband and a ripple of in the stopband

⎩⎨⎧=ω

stopbandthein,0passbandthein,1

)(D

)(ωH(

pδ±sδ

9Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• Thus, weighting function can be chosen either as

or⎩⎨⎧

δδ=ω

stopbandthein,/passbandthein,1

)(sp

W

⎩⎨⎧ δδ

=ωstopbandthein,1passbandthein,/

)( psW

10Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• Type 1 FIR Filter -where

• Type 2 FIR filter -

where

∑ ω=ω=

M

kkkaH

0)cos(][)(

(

( )∑ −ω=ω+

=

2/)12(

121)(cos][)(

M

kkkbH

(

MkkMhkaMha ≤≤−== 1],[2][],[]0[

212

212 1],[2][ ++ ≤≤−= MM kkhkb

11Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• Type 3 FIR Filter -where

• Type 4 FIR Filter -

where

∑ ω=ω=

M

kkkcH

1)sin(][)(

(

( )∑ −ω=ω+

=

2/)12(

121)(sin][)(

M

kkkdH

(

MkkMhkc ≤≤−= 1],[2][

212

212 1],[2][ ++ ≤≤−= MM kkhkd

12Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• Amplitude response for all 4 types of linear-phase FIR filters can be expressed as

where)()()( ωω=ω AQH

(

⎪⎪⎩

⎪⎪⎨

ωωω

4Typefor),2/sin(3Typefor),sin(2Typefor/2),cos(1Typefor,1

)(Q

3

13Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

and

where

∑ ω=ω=

L

kkkaA

0)cos(][~)(

⎪⎪⎩

⎪⎪⎨

=

4Typefor],[~3Typefor],[~2Typefor],[~1Typefor],[

][~

kdkckbka

ka

14Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

with

, , and , are related to b[k], c[k], and d[k], respectively

⎪⎪⎩

⎪⎪⎨

−=

4Typefor,3Typefor,12Typefor,1Typefor,

212

212

M

M

M

M

L

][~ kb ][~ kc ][~ kd

15Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• Modified form of weighted error function

where we have used the notation

)]()()()[()( ω−ωωω=ω DAQW])()[()(

)()(

ωω−ωωω=

QDAQW)](~)()[(~ ω−ωω= DAW

)()()(~ ωω=ω QWW

)(/)()(~ ωω=ω QDD

E

16Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• Optimization Problem - Determine which minimize the peak absolute value of

over the specified frequency bands• After has been determined,

corresponding coefficients of the original are computed from which h[n] are

determined

][~ ka

R∈ω

ε

)(ωA

][~ ka

)](~)cos(][~)[(~)(0

ω−∑ ωω=ω=

DkkaWL

kE

17Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• Alternation Theorem - is the best unique approximation of D(ω) obtained by minimizing peak absolute value of

if and only if there exist at least L+2extremal frequencies, in a closed subset R of the frequency range

such that and , for all i

)]()()()[()( ω−ωωω=ω DAQW

)(ωA

ε

,10},{ +≤≤ω Lii

π≤ω≤0 110 +ω<ω<<ω<ω LLL

)()( 1+ω−=ω ii EE ε=ω )( iE

E

~

18Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• Consider a Type 1 FIR filter with an amplitude response whose approximation error satisfies the Alternation Theorem

• Peaks of are at where

• Since in the passband and stopband, and are piecewise constant,

)(ωA)(ωE

)(ωE 10, +≤≤ω=ω Lii0/)( =ωω ddE

0)()( =ωω=

ωω

ddA

ddE

)(~ ωW)(~ ωD

at iω=ω

4

19Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• Using , where is the k-th order Chebyshev polynomial

• can be expressed as

which is an Lth-order polynomial in• Hence, can have at most local

minima and maxima inside specified passband and stopband

)(cos)cos( ω=ω kTk )(xTk

)coscos()( 1 xkxTk−=

)(ωA

)(ωA 1−Lωcos

∑ ωα=ω =Lk

kkA 0 )](cos[)(

20Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• At bandedges, and , is a maximum, and hence has extrema at these points

• can have extrema at and• Therefore, there are at most L+3 extremal

frequencies of• For linear-phase FIR filters with K specified

bandedges, there can be at most L+K+1extremal frequencies

pω=ω sω=ω

π=ω0=ω)(ωA

)(ωA

)(ωE

)(ωE

21Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• The set of equations

is written in a matrix form

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

εω−ωωω−ωω

ωωωω−ωω

⎥⎥⎥⎥

⎢⎢⎢⎢

+++

− ][~

]1[~]0[~

)(~/)1()cos()cos(1)(~/)1()cos()cos(1

)(~/1)cos()cos(1)(~/1)cos()cos(1

111

1

111

000

La

aa

WLWL

WLWL

LL

LL

LL

LL

M

L

L

MMOMM

L

L

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

ωω

ωω

=

+ )(~)(~

)(~)(~

1

1

0

L

LDD

DD

M

10,)1()](~)()[(~ +≤≤ε−=ω−ωω LiDAW iiii

22Copyright © 2005, S. K. Mitra

Design of Design of EquirippleEquirippleLinearLinear--Phase FIR FiltersPhase FIR Filters

• The matrix equation can be solved for the unknowns and if the locations of the L+2 extremal frequencies are known a priori

• The Remez exchange algorithm is used to determine the locations of the extremalfrequencies

][~ ia ε

23Copyright © 2005, S. K. Mitra

RemezRemez Exchange AlgorithmExchange Algorithm• Step 1: A set of initial values of extremal

frequencies are either chosen or are available from completion of previous stage

• Step 2: Value of is computed using

where

ε

)(~)1(

)(~)(~

)(~)(~)(~

1

11

1

1

0

0

111100

+

++

++

ω−++

ω−

ω

ω++ω+ω=ε

L

LL

LL

Wc

Wc

Wc

DcDcDc

L

L

∏ ω−ω=

+

≠=

1

0 )cos()cos(1L

nii in

nc

24Copyright © 2005, S. K. Mitra

RemezRemez Exchange AlgorithmExchange Algorithm• Step 3: Values of at are then

computed using

• Step 4: The polynomial is determined by interpolating the above values at the L+2extremal frequencies using the Lagrange interpolation formula

)(ωA

)(ωA

iω=ω

10),(~)(~

)1()( +≤≤ω+ωε−=ω LiD

WA i

i

i

i

5

25Copyright © 2005, S. K. Mitra

RemezRemez Exchange AlgorithmExchange Algorithm• Step 4: The new error function

is computed at a dense set S ( ) of frequencies. In practice S = 16L is adequate. Determine the L+2 new extremal frequencies from the values of evaluated at the dense set of frequencies.

• Step 5: If the peak values of are equal in magnitude, algorithm has converged. Otherwise, go back to Step 2.

)](~)()[(~)( ω−ωω=ω DAWE

)(ωE

)(ωE

ε

LS ≥

26Copyright © 2005, S. K. Mitra

RemezRemez Exchange AlgorithmExchange Algorithm• Illustration of algorithm

Iteration process is stopped if the difference between the values of the peak absolute errors between two consecutive stages is less than a preset value, e.g., 610−

27Copyright © 2005, S. K. Mitra

RemezRemez Exchange AlgorithmExchange Algorithm• Example - Approximate the desired

function defined for the range by a linear function by minimizing the peak value of the absolute error

• Stage 1: Choose arbitrarily the initial extremal points

1.01.1)( 2 −= xxD20 ≤≤ x 01 axa +

xaaxx 10

2

]2,0[1.01.1max −−−

5.1,5.0,0 321 === xxx

28Copyright © 2005, S. K. Mitra

RemezRemez Exchange AlgorithmExchange Algorithm

• Solve the three linear equations

i.e.,

for the given extremal points yielding

3,2,1),()1(10 ==−−+ lll

l xDxaa ε

⎥⎥⎦

⎢⎢⎣

⎡ −=

⎥⎥⎦

⎢⎢⎣

⎥⎥⎦

⎢⎢⎣

⎡−

375.2175.0

1.0

15.1115.01

1011

0

εaa

275.0,65.1,375.0 10 ==−= εaa

29Copyright © 2005, S. K. Mitra

RemezRemez Exchange AlgorithmExchange Algorithm• Plot of along

with values of error at chosen extremalpoints shown below

• Note: Errors are equal in magnitude and alternate in sign

275.065.11.1)( 21 +−= xxxE

0 0.5 1 1.5 2-0.5

0

0.5

1

1.5

x

Err

or

30Copyright © 2005, S. K. Mitra

RemezRemez Exchange AlgorithmExchange Algorithm• Stage 2:• Choose extremal points where

assumes its maximum absolute values• These are• New values of unknowns are obtained by

solving

yielding

)(1 xE

2,75.0,0 321 === xxx

⎥⎥⎦

⎢⎢⎣

⎡ −=

⎥⎥⎦

⎢⎢⎣

⎥⎥⎦

⎢⎢⎣

⎡−

3.45188.0

1.0

121175.01

1011

0

εaa

5156.0,2.2,6156.0 10 ==−= εaa

6

31Copyright © 2005, S. K. Mitra

RemezRemez Exchange AlgorithmExchange Algorithm

• Plot of along with values of error at chosen extremalpoints shown below

5156.02.21.1)( 22 +−= xxxE

0 0.5 1 1.5 2-1

-0.5

0

0.5

1

x

Erro

r

32Copyright © 2005, S. K. Mitra

RemezRemez Exchange AlgorithmExchange Algorithm• Stage 3:• Choose extremal points where

assumes its maximum absolute values• These are• New values of unknowns are obtained by

solving

yielding

)(2 xE

2,1,0 321 === xxx

⎥⎥⎦

⎢⎢⎣

⎡−=

⎥⎥⎦

⎢⎢⎣

⎥⎥⎦

⎢⎢⎣

⎡−

3.40.11.0

121111

1011

0

εaa

55.0,2.2,65.0 10 ==−= εaa

33Copyright © 2005, S. K. Mitra

RemezRemez Exchange AlgorithmExchange Algorithm• Plot of along

with values of error at chosen extremalpoints shown below

• Algorithm has converged as is also the maximum value of the absolute error

55.02.21.1)( 23 +−= xxxE

ε

0 0.5 1 1.5 2-1

-0.5

0

0.5

1

x

Erro

r

34Copyright © 2005, S. K. Mitra

Design of MinimumDesign of Minimum--Phase Phase FIR FiltersFIR Filters

• Linear-phase FIR filters with narrow transition bands are of very high order, and as a result have a very long group delay that is about half the filter order

• By relaxing the linear-phase requirement, it is possible to design an FIR filter of lower order thus reducing the overall group delay and the computational cost

35Copyright © 2005, S. K. Mitra

Design of MinimumDesign of Minimum--Phase Phase FIR FiltersFIR Filters

• A very simple method of minimum-phase FIR filter is described next

• Consider an arbitrary FIR transfer function of degree N:

∏=

−∑=

− ξ−==N

kk

N

n

n zhznhzH1

1

010 )(][][)(

36Copyright © 2005, S. K. Mitra

Design of MinimumDesign of Minimum--Phase Phase FIR FiltersFIR Filters

• The mirror-image polynomial to H(z) is given by

• The zeros of are thus at , i.e., are reciprocal to the zeros of H(z) at

)()(ˆ 1−−= zHzzH N

∏=

−∑=

− ξ−=−=N

kk

N

n

n zNhznNh1

1

01 )/(][][

)(ˆ zH kz ξ= /1

kz ξ=

7

37Copyright © 2005, S. K. Mitra

Design of MinimumDesign of Minimum--Phase Phase FIR FiltersFIR Filters

• As a result,

has zeros exhibiting mirror-image symmetry in the z-plane and is thus a Type 1 linear-phase transfer function of order 2N

• Moreover, if H(z) has a zero on the unit circle, will also have a zero on the unit circle at the conjugate reciprocal position

)()()(ˆ)()( 1−−== zHzHzzHzHzG N

)(ˆ zH

38Copyright © 2005, S. K. Mitra

Design of MinimumDesign of Minimum--Phase Phase FIR FiltersFIR Filters

• Thus, unit circle zeros of G(z) occur in pairs• On the unit circle we have

• Moreover, the amplitude response has double zeros in the frequency range

)()( ω=ω GeH j (2

0≥ω)(G(

)(ωG(

],[ π0

39Copyright © 2005, S. K. Mitra

Design of MinimumDesign of Minimum--Phase Phase FIR FiltersFIR Filters

• Design Procedure –• Step 1: Design a Type 1 linear-phase

transfer function F(z) of degree 2Nsatisfying the specifications:

• Note that F(z) has single unit circle zeros

)()( )( Fp

Fp F δ+≤ω≤δ− 11

(

)()( )( Fp

Fs F δ≤ω≤δ−

(for ],[ pω∈ω 0

],[ πω∈ω sfor

40Copyright © 2005, S. K. Mitra

Design of MinimumDesign of Minimum--Phase Phase FIR FiltersFIR Filters

• Step 2: Determine the linear-phase transfer function

• Its amplitude response satisfies)()( )( zFzzG NF

s +δ= −

)()()()( )( Fp

Fs

Fp

Fs G δ+δ+≤ω≤δ−δ+ 11

(

)()( FsG δ≤ω≤ 20

(for ],[ pω∈ω 0

],[ πω∈ω sfor

41Copyright © 2005, S. K. Mitra

Design of MinimumDesign of Minimum--Phase Phase FIR FiltersFIR Filters

• Note that G(z) has double zeros on the unit circle and all other zeros are situated with a mirror-image symmetry

• Hence, it can be expressed in the form

where is a minimum-phase transfer function containing all zeros of G(z) that are inside the unit circle and one each of the unit circle double zeros

)()()( 1−−= zHzHzzG mmN

)(zHm

42Copyright © 2005, S. K. Mitra

Design of MinimumDesign of Minimum--Phase Phase FIR FiltersFIR Filters

• Step 3: Determine from G(z) by applying a spectral factorization

• The passband ripple and the stopbandripple of F(z) must be chosen to ensure that the specified passband ripple and the stopband ripple of are satisfied)(zHm

)(Fpδ

)(Fsδ

)(zHm

8

43Copyright © 2005, S. K. Mitra

Design of MinimumDesign of Minimum--Phase Phase FIR FiltersFIR Filters

• It can be shown

• An estimate of the order N of can be found by first estimating the order of F(z)and then dividing it by 2

• If the estimated order of F(z) is an odd integer, it should be increased by 1

s

sFs

s

pFp δ+

δ=δ−δ+

δ+=δ

12

11

1 )()( ,

)(zHm

44Copyright © 2005, S. K. Mitra

FIR Digital Filter Design Using FIR Digital Filter Design Using MATLABMATLAB

• Order Estimation -• Kaiser’s Formula:

• Note: Filter order N is inversely proportional to transition band width and does not depend on actual location of transition band

πω−ω

δδ−≅

2/)(6.14)(log20 10

ps

spN

)( ps ω−ω

45Copyright © 2005, S. K. Mitra

FIR Digital Filter Design Using FIR Digital Filter Design Using MATLABMATLAB

• Hermann-Rabiner-Chan’s Formula:

where

with

πω−ωπω−ωδδ−δδ

≅ ∞

2/)(]2/))[(,(),( 2

ps

psspsp FDN

sppsp aaaD δ+δ+δ=δδ∞ 1031022

101 log])(log)(log[),(])(log)(log[ 6105

2104 aaa pp +δ+δ+

]log[log),( 101021 spsp bbF δ−δ+=δδ4761.0,07114.0,005309.0 321 −=== aaa

4278.0,5941.0,00266.0 654 === aaa51244.0,01217.11 21 == bb 46

Copyright © 2005, S. K. Mitra

FIR Digital Filter Design Using FIR Digital Filter Design Using MATLABMATLAB

• Formula valid for• For , formula to be used is obtained

by interchanging and• Both formulas provide only an estimate of

the required filter order N• Frequency response of FIR filter designed

using this estimated order may or may not meet the given specifications

• If specifications are not met, increase filter order until they are met

sp δ≥δ

sp δ<δpδ sδ

47Copyright © 2005, S. K. Mitra

FIR Digital Filter Design Using FIR Digital Filter Design Using MATLABMATLAB

• MATLAB code fragments for estimating filter order using Kaiser’s formulanum = - 20*log10(sqrt(dp*ds)) - 13;den = 14.6*(Fs - Fp)/FT;N = ceil(num/den);

• M-file remezord implements Hermann-Rabiner-Chan’s order estimation formula

48Copyright © 2005, S. K. Mitra

FIR Digital Filter Design Using FIR Digital Filter Design Using MATLABMATLAB

• For FIR filter design using the Kaiser window, window order is estimated using the M-file kaiserord

• The M-file kaiserord can in some cases generate a value of N which is either greater or smaller than the required minimum order

• If filter designed using the estimated order Ndoes not meet the specifications, N should either be gradually increased or decreased until the specifications are met

9

49Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Digital Filter FIR Digital Filter Design Using MATLABDesign Using MATLAB

• The M-file remez can be used to design an equiripple FIR filter using the Parks-McClellan algorithm

• Example - Design an equiripple FIR filter with the specifications: kHz,

kHz, kHz, dB, dB

• Here, and

8.0=pF1=sF 4=TF 5.0=α p40=αs

0559.0=δ p 01.0=δs50

Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Digital Filter FIR Digital Filter Design Using MATLABDesign Using MATLAB

• MATLAB code fragments used are[N, fpts, mag, wt] =

remezord(fedge, mval, dev, FT);b = remez(N, fpts, mag, wt);where fedge = [800 1000],mval = [1 0], dev = [0.0559 0.01], andFT = 4000

51Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Digital Filter FIR Digital Filter Design Using MATLABDesign Using MATLAB

• The computed gain response with the filter order obtained (N = 28) does not meet the specifications ( dB, dB)

• Specifications are met with N = 30

0 0.2 0.4 0.6 0.8 1-60

-40

-20

0

ω/π

Gai

n, d

B

Equiripple FIR Lowpass Filter

0 0.1 0.2 0.3 0.4-0.5

0

0.5

ω/π

Gai

n, d

B

Passband Details

6.0=α p 7.38=αs

52Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Digital Filter FIR Digital Filter Design Using MATLABDesign Using MATLAB

• Example - Design a linear-phase FIR bandpass filter of order 26 with a passbandfrom 0.3 to 0.5, and stopbands from 0 to 0.25 and from 0.55 to 1

• The pertinent input data here areN = 26fpts = [0 0.25 0.3 0.5 0.55 1]mag = [0 0 1 1 0 0]wt = [1 1 1]

53Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Digital Filter FIR Digital Filter Design Using MATLABDesign Using MATLAB

• Computed gain response shown below where dB, dB1=α p 7.18=αs

0 0.2 0.4 0.6 0.8 1-60

-40

-20

0

ω/π

Gai

n, d

B

N = 26, weight ratio = 1

54Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Digital Filter FIR Digital Filter Design Using MATLABDesign Using MATLAB

• We redesign the filter with order increased to 110

• Computed gain response shown below where dB, dB

• Note: Increase inorder improvesgain response at theexpense of increasedcomputational complexity

2.51=αs024.0=α p

0 0.2 0.4 0.6 0.8 1-80

-60

-40

-20

0

ω/π

Gai

n, d

B

N = 110, weight ratio = 1

10

55Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Digital Filter FIR Digital Filter Design Using MATLABDesign Using MATLAB

• can be increased at the expenses of a larger by decreasing the relative weight ratio

• Gain response of bandpass filter of order 110 obtained with a weight vector[1 0.1 1]

• Now dB, dB

pαsα

spW δδ=ω /)(

076.0=α p 86.60=αs

0 0.2 0.4 0.6 0.8 1-80

-60

-40

-20

0

ω/π

Gai

n, d

B

N = 110, weight ratio = 1/10

56Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Digital Filter FIR Digital Filter Design Using MATLABDesign Using MATLAB

• Plots of absolute error for 1st design• Absolute error has

same peak value in all bands

• As L = 13, and there are 4 band edges, there can be at most

extrema• Error plot exhibits 17 extrema

0 0.2 0.4 0.6 0.8 1-0.2

-0.1

0

0.1

0.2

ω/π

Abs

olut

e E

rror

N = 26, weight ratio = 1

1861 =+−L

57Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Digital Filter FIR Digital Filter Design Using MATLABDesign Using MATLAB

• Absolute error has same peak value in all bands for the 2nd design

• Absolute error in passband of 3rd design is 10 times the error in the stopbands

0 0.2 0.4 0.6 0.8 1-4

-2

0

2

4x 10

-3

ω/π

Abs

olut

e E

rror

N = 110, weight ratio = 1

0 0.2 0.4 0.6 0.8 1-0.01

-0.005

0

0.005

0.01

ω/π

N = 110, weight ratio = 1/10

58Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Digital Filter FIR Digital Filter Design Using MATLABDesign Using MATLAB

• Example - Design a linear-phase FIR bandpass filter of order 60 with a passbandfrom 0.3 to 0.5, and stopbands from 0 to 0.25 and from 0.6 to 1 with unequal weights

• The pertinent input data here areN = 60fpts = [0 0.25 0.3 0.5 0.6 1]mag = [0 0 1 1 0 0]wt = [1 1 0.3]

59Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Digital Filter FIR Digital Filter Design Using MATLABDesign Using MATLAB

• Plots of gain response and absolute error shown below

0 0.2 0.4 0.6 0.8 1-80

-60

-40

-20

0

ω/π

Gai

n, d

B

0 0.2 0.4 0.6 0.8 1-0.1

-0.05

0

0.05

0.1

ω/π

Abs

olut

e E

rror

60Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Digital Filter FIR Digital Filter Design Using MATLABDesign Using MATLAB

• Response in the second transition band shows a peak with a value higher than that in passband

• Result does not contradict alternation theorem• As N = 60, M = 30, and hence, there must be

at least M + 2 = 32 extremal frequencies• Plot of absolute error shows the presence of

32 extremal frequencies

11

61Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Digital Filter FIR Digital Filter Design Using MATLABDesign Using MATLAB

• If gain response of filter designed exhibits a nonmonotonic behavior, it is recommended that either the filter order or the bandedgesor the weighting function be adjusted until a satisfactory gain response has been obtained

• Gain plot obtainedby moving thesecond stopbandedge to 0.55

0 0.2 0.4 0.6 0.8 1-80

-60

-40

-20

0

ω/π

Gai

n, d

B

62Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Differentiator FIR Differentiator Design Using MATLABDesign Using MATLAB

• A lowpass differentiator has a bandlimitedfrequency response

where represents the passbandand represents the stopband

• For the design phase we choose

⎩⎨⎧

π≤ω≤ωω≤ω≤ω

s

pjDIF

jeH

,00,

)(

pω≤ω≤0π≤ω≤ωs

pDW ω≤ω≤=ωω=ω 0,1)(,/1)(

63Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Differentiator FIR Differentiator Design Using MATLABDesign Using MATLAB

• The M-file remezord cannot be used to estimate the order of an FIR differentiator

• Example - Design a full-band ( ) differentiator of order 11

• Code fragment to useb = remez(N, fpts, mag, ‘differentiator’);where N = 11

fpts = [0 1]mag = [0 pi]

π=ωp

64Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Differentiator FIR Differentiator Design Using MATLABDesign Using MATLAB

• Plots of magnitude response and absolute error

• Absolute error increases with as the algorithm results in an equiripple error of the function ]1[ )( −ω

ωA

ω0 0.2 0.4 0.6 0.8 1

0

1

2

3

ω/π

Mag

nitu

de

0 0.2 0.4 0.6 0.8 1-0.1

-0.05

0

0.05

0.1

ω/π

Abs

olut

e E

rror

65Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Differentiator FIR Differentiator Design Using MATLABDesign Using MATLAB

• Example - Design a lowpass differentiator of order 50 with and

• Code fragment to useb = remez(N, fpts, mag, ‘differentiator’);where

N = 50fpts = [0 0.4 0.45 1]mag = [0 0.4*pi 0 0]

πω 4.0=p πω 45.0=s

66Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Differentiator FIR Differentiator Design Using MATLABDesign Using MATLAB

• Plot of the magnitude response of the lowpass differentiator

0 0.2 0.4 0.6 0.8 10

0.5

1

1.5

ω/π

Mag

nitu

de

12

67Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Hilbert Transformer FIR Hilbert Transformer Design Using MATLABDesign Using MATLAB

• Desired amplitude response of a bandpassHilbert transformer is

with weighting function

• Impulse response of an ideal Hilbert transformer satisfies the condition

which can be met by a Type 3 FIR filter

HLD ω≤ω≤ω=ω ,1)(

HLW ω≤ω≤ω=ω ,1)(

evenfor,0][ nnhHT =

68Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Hilbert Transformer FIR Hilbert Transformer Design Using MATLABDesign Using MATLAB

• Example - Design a linear-phase bandpassFIR Hilbert transformer of order 20 with

,• Code fragment to use

b = remez(N, fpts, mag, ‘Hilbert’);where

N = 20fpts = [0.1 0.9]mag = [1 1]

π=ω 1.0L π=ω 9.0H

69Copyright © 2005, S. K. Mitra

EquirippleEquiripple FIR Hilbert Transformer FIR Hilbert Transformer Design Using MATLABDesign Using MATLAB

• Plots of magnitude response and absolute error

0 0.2 0.4 0.6 0.8 1-0.04

-0.02

0

0.02

0.04

ω/π

Abs

olut

e E

rror

0 0.2 0.4 0.6 0.8 10

0.2

0.4

0.6

0.8

1

ω/π

Mag

nitu

de

70Copyright © 2005, S. K. Mitra

WindowWindow--Based FIR Filter Based FIR Filter Design Using MATLABDesign Using MATLAB

• Window Generation - Code fragments to usew = blackman(L);w = hamming(L);w = hanning(L);w = chebwin(L, Rs);w = kaiser(L, beta);where window length L is odd

71Copyright © 2005, S. K. Mitra

WindowWindow--Based FIR Filter Based FIR Filter Design Using MATLABDesign Using MATLAB

• Example - Kaiser window design for use in a lowpass FIR filter design

• Specifications of lowpass filter: , , dB

• Code fragments to use[N, Wn, beta, ftype] = kaiserord(fpts, mag,dev);w = kaiser(N+1, beta);where fpts = [0.3 0.4]

mag = [1 0]dev = [0.003162 0.003162]

π=ω 4.0s

π=ω 3.0p50=αs 003162.0=δ⇒ s

72Copyright © 2005, S. K. Mitra

WindowWindow--Based FIR Filter Based FIR Filter Design Using MATLABDesign Using MATLAB

• Plot of the gain response of the Kaiser window

0 0.2 0.4 0.6 0.8 1-80

-60

-40

-20

0

ω/π

Gai

n, d

B

Gain Response of Kaiser Window

13

73Copyright © 2005, S. K. Mitra

WindowWindow--Based FIR Filter Based FIR Filter Design Using MATLABDesign Using MATLAB

• M-files available are fir1 and fir2• fir1 is used to design conventional lowpass,

highpass, bandpass, bandstop and multibandFIR filters

• fir2 is used to design FIR filters with arbitrarily shaped magnitude response

• In fir1, Hamming window is used as a default if no window is specified

74Copyright © 2005, S. K. Mitra

WindowWindow--Based FIR Filter Based FIR Filter Design Using MATLABDesign Using MATLAB

• Example - Design using a Kaiser window a lowpass FIR filter with the specifications:

, ,• Code fragments to use

[N, Wn, beta, ftype] = kaiserord(fpts, mag, dev);b = fir1(N, Wn, kaiser(N+1, beta));where fpts = [0.3 0.4]

mag = [1 0]dev = [0.003162 0.003162]

π=ω 3.0p π=ω 4.0s 003162.0=δs

75Copyright © 2005, S. K. Mitra

WindowWindow--Based FIR Filter Based FIR Filter Design Using MATLABDesign Using MATLAB

• Plot of gain response

0 0.2 0.4 0.6 0.8 1-80

-60

-40

-20

0

ω/π

Gai

n, d

B

Lowpass Filter Designed Using Kaiser Window

76Copyright © 2005, S. K. Mitra

WindowWindow--Based FIR Filter Based FIR Filter Design Using MATLABDesign Using MATLAB

• Example - Design using a Kaiser window a highpass FIR filter with the specifications:

, ,• Code fragments to use • [N, Wn, beta, ftype] = kaiserord(fpts, mag, dev);

b = fir1(N, Wn, ‘ftype’, kaiser(N+1, beta));where fpts = [0.4 0.55]

mag = [0 1]dev = [0.02 0.02]

π=ω 55.0p π=ω 4.0s 02.0=δs

77Copyright © 2005, S. K. Mitra

WindowWindow--Based FIR Filter Based FIR Filter Design Using MATLABDesign Using MATLAB

• Plot of gain response

0 0.2 0.4 0.6 0.8 1-80

-60

-40

-20

0

ω/π

Gai

n, d

B

Higpass Filter Designed Using Kaiser Window

78Copyright © 2005, S. K. Mitra

WindowWindow--Based FIR Filter Based FIR Filter Design Using MATLABDesign Using MATLAB

• Example - Design using a Hamming window an FIR filter of order 100 with three different constant magnitude levels: 0.3 in the frequency range [0, 0.28], 1.0 in the frequency range [0.3, 0.5], and 0.7 in the frequency range [0.52, 1.0]

14

79Copyright © 2005, S. K. Mitra

WindowWindow--Based FIR Filter Based FIR Filter Design Using MATLABDesign Using MATLAB

• Code fragment to useb = fir2(100, fpts, mval);where fpts = [0 0.28 0.3 0.5 0.52 1];

mval = [0.3 0.3 1.0 1.0 0.7 0.7];

0 0.2 0.4 0.6 0.8 10

0.2

0.4

0.6

0.8

1

ω/π

Mag

nitu

de

Multiband Filter

80Copyright © 2005, S. K. Mitra

MinimumMinimum--Phase FIR Filter Phase FIR Filter Design Using MATLABDesign Using MATLAB

• The minimum-phase FIR filter design method outlined earlier involves the spectral factorization of a Type 1 linear-phase FIRtransfer function G(z) with a non-negative amplitude response in the form

where contains all zeros of G(z) that are inside the unit circle and one each of the unit circle double zeros

)()()( 1−−= zHzHzzG mmN

)(zHm

81Copyright © 2005, S. K. Mitra

Spectral FactorizationSpectral Factorization

• We next outline the basic idea behind a simple spectral factorization method

• Without any loss of generality we consider the spectral factorization of a 6-th order linear-linear phase FIR transfer function G(z) with a non-negative amplitude response:

30

21

123

−−− +++= zgzgzggzG )(6

35

24

1−−− +++ zgzgzg

82Copyright © 2005, S. K. Mitra

Spectral FactorizationSpectral Factorization

• Our objective is to express the above G(z)in the form

where

is the minimum-phase factor of G(z)

)()()( 13 −−= zHzHzzG mm

33

22

110

−−− +++= zazazaazHm )(

83Copyright © 2005, S. K. Mitra

Spectral FactorizationSpectral Factorization

• Expressing G(z) in terms of the coefficients of we get

• Forming the product of the two polynomials given above and comparing the coefficients of like powers of the product with that of G(z) given on the previous slide we arrive at 4 equations given in the next slide

×+++= −−− )()( 33

22

110 zazazaazG

)( 30

21

123

−−− +++ zazazaa

)(zHm

1−z

84Copyright © 2005, S. K. Mitra

Spectral FactorizationSpectral Factorization

• The above set of equations is then solved iteratively using the Newton-Raphsonmethod

23

22

21

200 aaaag +++=

3221101 aaaaaag ++=

31202 aaaag +=

303 aag =

15

85Copyright © 2005, S. K. Mitra

Spectral FactorizationSpectral Factorization

• First, the initial values of are chosen to ensure that has all zeros strictly inside the unit circle

• Then, the coefficients are changed by adding the corrections so that the modified values satisfy better the set of 4 equalities given in the previous slide

• The process is repeated until the iteration converges

ia

iaie

ii ea +

)(zHm

86Copyright © 2005, S. K. Mitra

Spectral FactorizationSpectral Factorization• Substituting in the 4 equations given

earlier and expanding the products, a set of linear equations are obtained by eliminating all quadratic terms in from the expansion

• In matrix form, these equations can be written as where

ii ea +

ie

bAe =

⎥⎥⎥

⎢⎢⎢

⎡++=

03

1032

213201

3210

00

2222

aaaaaaaaaaaaaaaa

A

87Copyright © 2005, S. K. Mitra

Spectral FactorizationSpectral Factorizationand

• The matrix A can be expressed as

,⎥⎥⎥

⎢⎢⎢

=

3

2

1

0

eeee

e⎥⎥⎥

⎢⎢⎢

−−−

−−−−−−−

=

302

31202

3221101

23

22

21

200

aagaaaag

aaaaaagaaaag

b

⎥⎥⎥

⎢⎢⎢

+⎥⎥⎥

⎢⎢⎢

=

0

10

210

3210

3

32

321

3210

00000

0

000000

aaaaaaaaaa

aaa

aaaaaaa

A

88Copyright © 2005, S. K. Mitra

Spectral FactorizationSpectral Factorization• The iteration convergence is checked at

each step by evaluating the error term

• The error term first decreases monotonically and the iteration is stopped when the error starts increasing

• The M-file minphase.m implements the above spectral factorization method

∑ =3

02

i ie

89Copyright © 2005, S. K. Mitra

MinimumMinimum--Phase FIR Filter Phase FIR Filter Design Using MATLABDesign Using MATLAB

• Example – Design a minimum-phase lowpass FIR filter with the following specifications: , ,

dB and dB• Using Program 10_3.m we arrive at the

desired filter• Plots of zeros of G(z), zeros of , and

the gain response of are shown in the next slide

π=ω 450.p π=ω 60.s2=pR 26=sR

)(zHm)(zHm

90Copyright © 2005, S. K. Mitra

MinimumMinimum--Phase FIR Filter Phase FIR Filter Design Using MATLABDesign Using MATLAB

-2 -1 0 1

-1

-0.5

0

0.5

1

2 16

Real Part

Imag

inar

y P

art

Zeros of G(z)

-1.5 -1 -0.5 0 0.5 1 1.5

-1

-0.5

0

0.5

1

8

Real Part

Imag

inar

y P

art

Zeros of Hm(z)

0 0.2 0.4 0.6 0.8 1-80

-60

-40

-20

0

20

ω/π

Gai

n, d

B

Gain response of Hm(z)

16

91Copyright © 2005, S. K. Mitra

MaximumMaximum--Phase FIR Filter Phase FIR Filter Design Using MATLABDesign Using MATLAB

• A maximum-phase spectral factor of a linear-phase FIR filter with an impulse response b of even order with a non-negative zero-phase frequency response can be designed by first computing its minimum-phase spectral factor h and the using the statement

G = fliplr(h)

92Copyright © 2005, S. K. Mitra

Design of Computationally Design of Computationally Efficient FIR Digital FiltersEfficient FIR Digital Filters

• As indicated earlier, the order N of a linear-phase FIR filter is inversely proportional to the width ∆ω of the transition band

• Hence, in the case of an FIR filter with a very sharp transition, the order of the filter is very high

• This is particularly critical in designing very narrow-band or very wide-band FIR filters

93Copyright © 2005, S. K. Mitra

Design of Computationally Design of Computationally Efficient FIR Digital FiltersEfficient FIR Digital Filters

• The computational complexity of a digital filter is basically determined by the total number of multipliers and adders needed to implement the filter

• The direct form implementation of a linear-phase FIR filter of order N requires, in general, multipliers and N two-input adders

⎣ ⎦21+N

94Copyright © 2005, S. K. Mitra

Design of Computationally Design of Computationally Efficient FIR Digital FiltersEfficient FIR Digital Filters

• We now outline two methods of realizing computationally efficient linear-phase FIR filters

• The basic building block in both methods is an FIR subfilter structure with a periodic impulse response

95Copyright © 2005, S. K. Mitra

The Periodic Filter SectionThe Periodic Filter Section• Consider a Type 1 linear-phase FIR filter

F(z) of even degree N:

• Its delay-complementary filter E(z) is given by

∑=

−=N

n

nznfzF0

][)(

∑=

−−− −=−=N

n

nNN znfzzFzzE0

22 ][)()( //

≠=

−− −−=N

Nnn

nN znfzNf2

0

221

/

/ ][])/[(96

Copyright © 2005, S. K. Mitra

The Periodic Filter SectionThe Periodic Filter Section• The transfer function H(z) obtained by

replacing in F(z) with , with L being a positive integer, is given by

• The order of H(z) is thus NL• A direct realization of H(z) is obtained by

simply replacing each unit delay in the realization of F(z) with L unit delays

1−z Lz−

∑=

−==N

n

nLL znfzFzH0

][)()(

17

97Copyright © 2005, S. K. Mitra

The Periodic Filter SectionThe Periodic Filter Section

• Note: The number of multiplers and delays in the realization of H(z) is the same as those in the realization of F(z)

• The transfer function H(z) has a sparse impulse response of length , with

zero-valued samples inserted between every consecutive pair of impulse response samples of F(z)

1+NL1−L

98Copyright © 2005, S. K. Mitra

The Periodic Filter SectionThe Periodic Filter Section

• The parameter L is called the sparsity factor• The relations between the amplitude

responses of these two filters is given by

• It follows from the above that the amplitude response is a period function of ω with a period 2π/L

)()( ω=ω LFH((

)(ωH(

99Copyright © 2005, S. K. Mitra

The Periodic Filter SectionThe Periodic Filter Section

• One period of is obtained by compressing the amplitude response in the interval [0, 2π] to the interval [0, 2π/L]

• A transfer function H(z) with a frequency response that is a periodic function of ωwith a period 2π/L is called a periodic filter

)(ωH(

)(ωF(

100Copyright © 2005, S. K. Mitra

The Periodic Filter SectionThe Periodic Filter Section

• If F(z) is a lowpass filter with a single pasband and a single stopband, H(z) will be a multiband filter with pasbandsand stopbands as shown in the next slide for L = 4

⎣ ⎦ 12 +/L⎡ ⎤2/L

101Copyright © 2005, S. K. Mitra

The Periodic Filter SectionThe Periodic Filter Section

1

0 π0

ωs(F )

L

ω p( F)

L

2πL

2π – ω p( F)

L

2π – ωs( F)

L

↑ ↑2π + ωs

( F)

L

↑ω

G(ω) = E(Lω) H(ω) = F(Lω)

0

1F(ω )

πω p( F) ωs

(F )0 ω

E(ω) = 1 F(ω)_

delay-complementary filter E(z)

delay-complementary periodic filter G(z)

periodic filter H(z)

102Copyright © 2005, S. K. Mitra

The Periodic Filter SectionThe Periodic Filter Section• Let F(z) be a lowpass filter with passband

edge at and and stopband edge at , where

• Then, the passband and stopband edges of the first band of H(z) are at and , respectively

• The passband and stopband edges of the second band of H(z) are at and , respectively, and so on as shown on the previous slide

)(Fpω

)(Fsω π<ω )(F

s

LFp /)( )(ω±π2

LFp /)( )(ω±π2

LFp /)(ω

LFp /)(ω

18

103Copyright © 2005, S. K. Mitra

The Periodic Filter SectionThe Periodic Filter Section• The width of the transition bands of H(z)

are , which is -th of that of F(z)

• Likewise, the transfer function G(z) by replacing in E(z) with , is given by

• The amplitude response of G(z) is given by

LFp

Fs /)( )()( ω−ω

L1

1−z Lz−

)()()( / LNLL zFzzEzG −== − 2

∑=

−− −=N

n

nLNL znfz0

2 ][/

)()()( ω−=ω−=ω LFHG(((

11104

Copyright © 2005, S. K. Mitra

Interpolated FIR FilterInterpolated FIR Filter• The overall filter is designed as a

cascade of a linear-phase FIR filter and another filter I(z) that suppreses the undesired passbands of the periodic filter section as shown below

• The widths of the transition band and the passband of the cascade are –th of those of F(z)

)(zHIFIR)( LzF

I(z))( LzF

periodic filter interpolator

L1

105Copyright © 2005, S. K. Mitra

Interpolated FIR FilterInterpolated FIR Filter• The cascaded structure is called the

interpolated finite impulse response (IFIR) filter, as the missing impulse response samples of the periodic filter section are being interpolated by the filter section I(z), called the interpolator

• As the filter F(z) determines approximately the shape of the amplitude response of the IFIR filter, it is called a shaping filter

106Copyright © 2005, S. K. Mitra

Interpolated FIR FilterInterpolated FIR Filter• Design Steps –• IFIR specifications: passband edge ,

stopband edge , passband ripple , stopband ripple

• Shaping filter specifications: passband edge stopband edge passband ripple stopband ripple

pF

p Lω=ω )(

sωsδ

pδpω

sF

s Lω=ω )(

2/)(p

Fp δ=δ

sF

s δ=δ )(

107Copyright © 2005, S. K. Mitra

Interpolated FIR FilterInterpolated FIR Filter• The interpolator I(z) has to be designed to

preserve the passband of in the frequency range and mask the amplitude response of in the frequency range , where the periodic subfilter has unwanted passbands and transition bands

• This latter region is defined by

)( LzF],[ pω0

)( LzF],[ πωs

⎣ ⎦

⎥⎦⎤

⎢⎣⎡

⎟⎠⎞

⎜⎝⎛ πω+π

ω−π

==

ω ,min,/

ss

L

k Lk

LkR 222

1U

108Copyright © 2005, S. K. Mitra

Interpolated FIR FilterInterpolated FIR Filter• The transition band of the interpolator is the

frequency range

• Figure below shows the amplitude responses of and I(z)

⎥⎦⎤

⎢⎣⎡ ω−

πω sp L

2,

)(zHIFIR

←→

ω

2π – ωsL

ω p ωs

2π +ωsL

4π – ωsL

↑↑↑ π

1

00

I (ω)

don'tcare↵

H (ω)IFIR

19

109Copyright © 2005, S. K. Mitra

Interpolated FIR FilterInterpolated FIR Filter• Summarinzing, the design specifications for

F(z) and I(z) are as follows:forforforfor

The two linear-phase FIR filters F(z) and I(z) can be designed using the Parks-McClellan method

)()( )( Fp

Fp F δ+≤ω≤δ− 11

(],[ pLω∈ω 0

)()( )( Ip

Ip I δ+≤ω≤δ− 11

()()( )( F

sF

s F δ≤ω≤δ−(

)()( )( Is

Is I δ≤ω≤δ−

(

],[ πω∈ω sL],[ pω∈ω 0

ω∈ω R

110Copyright © 2005, S. K. Mitra

Interpolated FIR FilterInterpolated FIR Filter• Example – Filter specifications are as

follows: , , ,

• It follows from the figure in Slide 101 that to ensure no overlaps between adjacent passbands of , we should choose L to satisfy the condition

π=ω 150.p π=ω 20.s 0020.=δ p0010.=δs

)( LzF

LL

Fs

Fs

)()( ω−π<ω 2

111Copyright © 2005, S. K. Mitra

Interpolated FIR FilterInterpolated FIR Filter• For our example, this reduces to

implying L < 5• Hence, the largest value of L that can be

used is L = 4, yielding an IFIR structure requiring the least number of multipliers

• As a result, the specifications for F(z) and I(z) are as given in the next slide

π−π<π 20220 .. L

112Copyright © 2005, S. K. Mitra

Interpolated FIR FilterInterpolated FIR Filter• F(z):

• I(z):

• The filter orders of F(z) and I(z) obtained using remezord are:

Order of F(z) = 32Order of I(z) = 43

π=ωπ=ω 8060 .,. )()( Fs

Fp

00100010 .,. )()( =δ=δ Fs

Fp

π=ωπ=ω 30150 .,. )()( Is

Ip

00100010 .,. )()( =δ=δ Is

Ip

113Copyright © 2005, S. K. Mitra

Interpolated FIR FilterInterpolated FIR Filter• It can be shown that the filters F(z) and I(z)

designed using remez with the above orders do not lead to an IFIR design meeting the minimum stopband attenuation of 60 dB

• To meet the stopband specifications, the orders of F(z) and I(z) need to be increased to 33 and 46, respectively

114Copyright © 2005, S. K. Mitra

Interpolated FIR FilterInterpolated FIR Filter• The pertinent gain responses of the

redesigned IFIR filter are shown below:

• The number of multipliers needed to implement F(z) and hence, is

0 0.2 0.4 0.6 0.8 1-80

-60

-40

-20

0

ω/π

Gai

n, d

B

I(z)F(z4)

0 0.2 0.4 0.6 0.8 1-80

-60

-40

-20

0

ω/π

Gai

n, d

B

HIFIR(z)

)( 4zF

⎡ ⎤ 172133 =+= /)(FR

20

115Copyright © 2005, S. K. Mitra

Interpolated FIR FilterInterpolated FIR Filter• The number of multipliers needed to

implement I(z) is:

• As a result, the total number of multipliers needed to implement is

• The number of multipliers needed to implement the direct single-stage implementation of the FIR filter is

⎡ ⎤ 242146 =+= /)(IR

412417 =+=IFIRR)(zHIFIR

⎣ ⎦ 6221122 =+ /)( 116Copyright © 2005, S. K. Mitra

FrequencyFrequency--Response Masking Response Masking ApproachApproach

• This approach makes use of the relation between a periodic filter generated from a Type 1 linear-phase FIR filter of even degree N and its delay-complementary filter G(z) given by

• The amplitude responses of F(z), its delay-complentary filter E(z), the periodic filter H(z) and its delay-complentary filter G(z)are shown in the next slide

)()( LzFzH =

)()()( // LNN zFzzHzzG −=−= −− 22

117Copyright © 2005, S. K. Mitra

FrequencyFrequency--Response Masking Response Masking ApproachApproach

0

1F(ω )

πω p( F) ωs

(F )0 ω

E(ω) = 1 F(ω)_

delay-complementary filter E(z)

delay-complementary periodic filter G(z)

periodic filter H(z)

1

0 π0

ωs(F )

L

ω p( F)

L

2πL

2π – ω p( F)

L

2π – ωs( F)

L

↑ ↑2π + ωs

( F)

L

↑ω

G(ω) = E(Lω) H(ω) = F(Lω)

118Copyright © 2005, S. K. Mitra

FrequencyFrequency--Response Masking Response Masking ApproachApproach

• By selectively masking out the unwanted pasbands of both H(z) and G(z) by cascading each with appropriate masking filters and , respectively, and connecting the resulting cascades in prallel, we can design a large class of FIR filters with sharper transition bands

• The overall structure is then realized as indicated in the next slide

)(zI1 )(zI2

119Copyright © 2005, S. K. Mitra

FrequencyFrequency--Response Masking Response Masking ApproachApproach

• Note: The delay block can be realized by tapping the FIR structure implementing

• Also, and can share the same delay-chain if they are realized using the transposed direct form structure

++

)(zI1

)(zI2

)( LzF

2/LNz−

2/NLz−

)( LzF)(zI1 )(zI2

120Copyright © 2005, S. K. Mitra

FrequencyFrequency--Response Masking Response Masking ApproachApproach

• The transfer function of the overall structure is given by

• The corresponding amplitude response is

)()()()()( zIzGzIzHzHFM 21 +=

)()]([)()( / zIzFzzIzF LNLL2

21 −+= −

)()]([)()()( ωω−+ωω=ω 21 1 ILFILFHFM(((((

21

121Copyright © 2005, S. K. Mitra

FrequencyFrequency--Response Masking Response Masking ApproachApproach

• The overall computational complexity is given by the complexities of F(z), and

• All these three filters have wide transition bands and, in general, require considerably fewer multipliers and adders than that required in a direct design of the desired sharp cutoff filter

)(zI1)(zI2

122Copyright © 2005, S. K. Mitra

FrequencyFrequency--Response Masking Response Masking ApproachApproach

• Design Objective – Given the specifications of , determine the specifications of F(z), and design these 3 filters

• Design method – Illustrated for lowpassfilter design

• Two different situations may arise depending on how the transition band of

is created

)(zI1 )(zI2

)(zHFM

)(zHFM

123Copyright © 2005, S. K. Mitra

FrequencyFrequency--Response Masking Response Masking ApproachApproach

• Case A – Transition band of is from one of the transition bands of H(z)

)(zHFM

0 π0

1

ω4π – ωs

(F)

L

I 1(ω)

I 2(ω)

2π + ω p( F)

L

2π – ω( F)

Lp

0 π0

1

ω2π + ωs

( F)

L

2π + ω p( F)

L

(ω)HFM

124Copyright © 2005, S. K. Mitra

FrequencyFrequency--Response Masking Response Masking ApproachApproach

• Bandedges of are related to the bandedges of F(z) as follows:

)(zHFM

,,)()(

LL

Fp

s

Fs

pω+π

=ωω+π=ωll 22

10 −≤≤ Ll

125Copyright © 2005, S. K. Mitra

FrequencyFrequency--Response Masking Response Masking ApproachApproach

• Case B – Transition band of is from one of the transition bands of G(z)

)(zHFM

0 π0

1

ω2π – ωp

(F )

L

2π + ω p(F)

L

1I 2(ω)

I (ω)

ωL

(F)s

0 π0

1

ω

(ω)

2π – ωs( F)

L

2π – ω p( F)

L

HFM

126Copyright © 2005, S. K. Mitra

FrequencyFrequency--Response Masking Response Masking ApproachApproach

• Bandedges of are related to the bandedges of F(z) as follows:

• Example – Specifications for a lowpassfilter: , , ,and

)(zHFM

,,)()(

LL

Fp

s

Fp

pω−π

=ωω−π

=ωll 22

π=ω 40.p π=ω 4020.s 010.=δ p00010.=δs

22

127Copyright © 2005, S. K. Mitra

FrequencyFrequency--Response Masking Response Masking ApproachApproach

• For designing the optimum value of L is in the range

• By calculating the total number of multipliers needed to realize F(z), , and

for all possible values of L, we arrive at the realization requiring the least number of multipliers obtained for L =16 is 229which is about 15% of that required in a direct single-stage realization

)(zHFM

)(zI1)(zI2

128Copyright © 2005, S. K. Mitra

FrequencyFrequency--Response Masking Response Masking ApproachApproach

• The gain response of the designed filter is shown below:

0 0.2 0.4 0.6 0.8 1

80

60

40

20

0

Gai

n, d

B

ω/π

_

_

_

_