19
Lectures 26-27 EE-802 ADSP SEECS-NUST EE 802-Advanced Digital Signal Processing Dr. Amir A. Khan Office : A-218, SEECS 9085-2162; [email protected]

DSP Lecture 26

  • Upload
    musama

  • View
    24

  • Download
    2

Embed Size (px)

DESCRIPTION

DSP Lecture 26

Citation preview

Page 1: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

EE 802-Advanced Digital Signal Processing

Dr. Amir A. KhanOffice : A-218, SEECS

9085-2162; [email protected]

Page 2: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Lecture Outline

• FIR Filter Design– Kaiser Window– Optimal Equiripple Design Technique

Page 3: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Optimal Equiripple Filter Design

Optimum design criterion

• Spread the weighted approximation error (between the desired frequency response and the actual frequency response) evenly across the passband and the stop band

• Even distribtion of ripples gives the name Equiripple

• Design solution minimizes the maximum approximation error (minimax problem) using Chebyshev error criterion

• Underlying algorithm is named Park-McClellan algorithm and incorporates Remez exchange algorithm for polynomial solution

Page 4: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Optimal Equiripple Filter Design

• Recall Type-I linear phase filter

0 1 2 3 … M

otherwise

MnnMhnh

0

0)()(

otherwise

MnnMhnh

0

0)()( 2/)()( Mjj

ej eeAeH

2/)()( Mjje

j eeAeH

M is even

M

n

njj enheH0

)()(

2/

0

2/ cos)(M

ke

Mj kkae

Page 5: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Optimal Equiripple Filter Design

M

n

njj enheH0

)()(

2/

0

2/ cos)(M

ke

Mj kkae

Tolerance scheme for typical low-pass filter

Approximate unity in passband with maximum error 1

Approximate zero in stopband with maximum error 2

Seek an algorithm that systematically varies L+1 impulse response coeffs. to meet above specs.

Park McClellan developed algos. with L, p, s and

ratio1/2 fixed to meet the specifications

L = M/2

Page 6: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Chebyshev Polynomials

)( je eA

L

ke kka

0

cos)( Can be expressed as polynomial

of degree ‘n’ in cos

coscos nTn

xTnNth order Chebyshev polynomial of first kind defined by:

2

; ;1

21

10

xTxxTxT

xxTxT

nnn

where ak are coefficients of this polynomial and are related to ae(k)

Page 7: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Approximation Error

• Key to exactly control p and s is to fix them at their desired values while letting 1 and 2 vary

• Formalizing the approximation error

• Note we need to know Hd(ej) only over sub-intervals of interest

Ae(ej) can take any shape between these sub-intervals

Typical frequencyresponse meetingdesired specs

(unweighted)

Page 8: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Optimization Problem-Alternation Theorem

• Determine the set of filter (impulse response) coefficients to minimize the maximum absolute value of E()

• Solution to the problem is provided by “Alternation Theorem”

Page 9: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Illustration of Alteration Theorem

1

0

Desired valueRegion

Alteration theorem requires 5+2 = 7 extrema at minimum

Consider a 5th order polynomial

Valid extrema (alternating) : 5 only

Valid extrema (alternating) : 5 only

Valid extrema (alternating) : 8

P3(x) uniquely satisfies the alternation criterion &thus represents the optimal solution

Page 10: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Conclusions from Alteration Theorem

• Determine the set of filter (impulse response) coefficients to minimize the maximum absolute value of E()

• Solution to the problem is provided by “Alteration Theorem”

• The unique polynomial of degree L that minimizes the maximum error will have at least L+2 extrema in the error

• The optimal frequency response will just touch the maximum ripple bounds

• Extrema must occur at the pass band and stop band edges and at either = 0 or or both

• Maximum number of local extrema is the L-1 local extrema plus the 4 band edges, i.e., L+3

• This extra extrema case is called extraripple design

Page 11: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Park McClellan Algorithm• Alteration theorem suggests that a unique solution exists for

optimal FIR filter design problem• Alternation theorem does not tell how to arrive at the solution

– filter order M (or L) not known– extremal frequencies (i) not known– nor do we know the filter (polynomial) parameters or error

• Park McClellan presented an algorithm using the Remez exchange method (assumes M and 2/1 are known)

• Choosing the weighting function W

and M correctly leads to =2 and thus the solution to the problem• Filter design specs already give s, p, 1 and 2

• M was approximated by Kaiser as

Page 12: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Ex.: Optimal Type-I Filter

Desired responselow-pass

Optimal filter response (to be designed)

Weighted Approximation Error

Weight Function (for different distortions in pass-band and stop-band)

Intervals of Interest for minimax

Alternation theorem for this problem ?• Identify set of coefficients corresponding to the filter representing unique best

approximation to the ideal low-pass filter, s.t.

• Ep(cos) exhibits at least (L+2) alternations between its plus and minus maximum value over the (union of) intervals of interest

Page 13: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Ex.: Optimal Type-I Filter

Convert in terms P(x)

Satisfies Alternation Theorem for L = 7

Alternations? Nine

For piecewise desired filters, we can verify alternation theorem directly from Ae(ej)

Page 14: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Ex.: Other Approx. L =7

# of Extrema of weighted error9 = L + 2

# of Extrema of weighted error10 = L + 3

# of Extrema of weighted error9 = L + 2

# of Extrema of weighted error9 = L + 2

Page 15: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Park McClellan Algorithm Flow-Chart

From Alternation Theorem

where is the optimal approximation error and i correspond to the extremal frequencies

Using and putting above equation in matrix form gives

Solved recursively to find optimal Ae(ej)

Further simplification by Park and McClellan showed

• Instead of finding A(ej) at extremal frequencies, Park et al used Lagrange interpolation to compute it at denser set of frequencies• This interpolation allows to compute the error function in one go• If E() is less than for all frequencies, optiumal solution has been attained• Else choose a new set of extremal frequencies

Page 16: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Park McClellan Algorithm Flow-Chart

Illustration of PM Algorithm

Originally selected extremal frequencies

x select new set of extremal frequencies

E>Optimal calculated was too small

Re-rerun algo. until E<

Page 17: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Low Pass Filter Design using PM Algo.

1 20.4 , 0.6 , 0.01, 0.001p s Approximate filter order

M = 26

Start PM algo by selecting i and

Run PM algorithm until optimum solution achieved

15 extrema in weighted error

satisfying the alternation theorem (L = M/2 = 13)Initial tolerance criterion not satisfied > 2

Re-run with an increased M

Page 18: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Low Pass Filter Design using PM Algo.

1 20.4 , 0.6 , 0.01, 0.001p s Approximate filter order

M = 26

Start PM algo by selecting i and

Run PM algorithm until optimum solution achieved

15 extrema in weighted error

satisfying the alternation theorem (L = M/2 = 13)Initial tolerance criterion not satisfied > 2

Re-run with an increased M = 27

Page 19: DSP Lecture 26

Lectures 26-27 EE-802 ADSP SEECS-NUST

Ex.: PM Design gone bad (BandPass Filter)

M = 74

Not monotonic in transition band

as PM does not ensure it

Alternation theorem still satisfied

Work AroundSystematically change • one or more band-edge freq.• filter order (length M+1)• weighting function