agc dsp agc dsp professor a g constantinides 1 digital filter specifications only the magnitude...

43
1 AGC DSP Professor A G Constantinides Digital Filter Digital Filter Specifications Specifications Only the magnitude approximation problem Four basic types of ideal filters with magnitude responses as shown below (Piecewise flat) 1 0 c c H LP (e j ) 0 c c 1 H HP (e j ) 1 1 c1 c1 c2 c2 H BP (e j ) 1 c1 c1 c2 c2 H BS (e j )

Upload: drusilla-stokes

Post on 23-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

1

AGC

DSP

AGC

DSP

Professor A G Constantinides

Digital Filter SpecificationsDigital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters with magnitude

responses as shown below (Piecewise flat)

1

0 c –c

HLP(e j)

0 c –c

1

HHP (e j)

11–

–c1 c1 –c2 c2

HBP (e j)

1

–c1 c1 –c2 c2

HBS(e j)

Page 2: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

2

AGC

DSP

AGC

DSP

Professor A G Constantinides

Digital Filter SpecificationsDigital Filter Specifications These filters are unealisable because

(one of the following is sufficient) their impulse responses infinitely long

non-causal Their amplitude responses cannot be

equal to a constant over a band of frequencies

Another perspective that provides some understanding can be obtained by looking at the ideal amplitude squared.

Page 3: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

3

AGC

DSP

AGC

DSP

Professor A G Constantinides

Digital Filter SpecificationsDigital Filter Specifications Consider the ideal LP response squared

(same as actual LP response)

1

0 c –c

HLP(e j)

0 c – c

Page 4: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

4

AGC

DSP

AGC

DSP

Professor A G Constantinides

Digital Filter SpecificationsDigital Filter Specifications The realisable squared amplitude

response transfer function (and its differential) is continuous in

Such functions if IIR can be infinite at point but

around that point cannot be zero. if FIR cannot be infinite anywhere.

Hence previous defferential of ideal response is unrealisable

Page 5: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

5

AGC

DSP

AGC

DSP

Professor A G Constantinides

Digital Filter SpecificationsDigital Filter Specifications A realisable response would

effectively need to have an approximation of the delta functions in the differential

This is a necessary condition

Page 6: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

6

AGC

DSP

AGC

DSP

Professor A G Constantinides

Digital Filter SpecificationsDigital Filter Specifications For example the magnitude response

of a digital lowpass filter may be given as indicated below

Page 7: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

7

AGC

DSP

AGC

DSP

Professor A G Constantinides

Digital Filter SpecificationsDigital Filter Specifications In the passband we

require that with a deviation

In the stopband we require that with a deviation

1)( jeG

0)( jeG s

pp 0

s

ppj

p eG ,1)(1

ssjeG ,)(

Page 8: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

8

AGC

DSP

AGC

DSP

Professor A G Constantinides

Digital Filter SpecificationsDigital Filter SpecificationsFilter specification parameters

- passband edge frequency

- stopband edge frequency

- peak ripple value in the passband

- peak ripple value in the stopband

ps

s

p

Page 9: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

9

AGC

DSP

AGC

DSP

Professor A G Constantinides

Digital Filter SpecificationsDigital Filter Specifications

Practical specifications are often given in terms of loss function (in dB)

Peak passband ripple

dB Minimum stopband attenuation dB

)(log20)( 10 jeGG

)1(log20 10 pp

)(log20 10 ss

Page 10: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

10

AGC

DSP

AGC

DSP

Professor A G Constantinides

Digital Filter SpecificationsDigital Filter Specifications

In practice, passband edge frequency and stopband edge frequency are specified in Hz

For digital filter design, normalized bandedge frequencies need to be computed from specifications in Hz using

TFF

F

F pT

p

T

pp

2

2

TFFF

F sT

s

T

ss 2

2

sFpF

Page 11: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

11

AGC

DSP

AGC

DSP

Professor A G Constantinides

Digital Filter SpecificationsDigital Filter Specifications

Example - Let kHz, kHz, and kHz

Then

7pF 3sF25TF

56.01025

)107(23

3

p

24.01025

)103(23

3

s

Page 12: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

12

AGC

DSP

AGC

DSP

Professor A G Constantinides

The transfer function H(z) meeting the specifications must be a causal transfer function

For IIR real digital filter the transfer function is a real rational function of

H(z) must be stable and of lowest order N or M for reduced computational complexity

Selection of Filter TypeSelection of Filter Type

1z

NN

MM

zdzdzddzpzpzpp

zH

22

110

22

110)(

Page 13: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

13

AGC

DSP

AGC

DSP

Professor A G Constantinides

Selection of Filter TypeSelection of Filter Type

FIR real digital filter transfer function is a polynomial in (order N) with real coefficients

For reduced computational complexity, degree N of H(z) must be as small as possible

If a linear phase is desired then we must have:

(More on this later)

N

n

nznhzH0

][)(

][][ nNhnh

1z

Page 14: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

14

AGC

DSP

AGC

DSP

Professor A G Constantinides

Selection of Filter TypeSelection of Filter Type Advantages in using an FIR filter -

(1) Can be designed with exact linear phase(2) Filter structure always stable with quantised coefficients

Disadvantages in using an FIR filter - Order of an FIR filter is considerably higher than that of an equivalent IIR filter meeting the same specifications; this leads to higher computational complexity for FIR

Page 15: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

15

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR DesignFIR DesignFIR Digital Filter DesignFIR Digital Filter Design

Three commonly used approaches to FIR filter design -(1) Windowed Fourier series approach(2) Frequency sampling approach(3) Computer-based optimization methods

Page 16: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

16

AGC

DSP

AGC

DSP

Professor A G Constantinides

Finite Impulse Response Finite Impulse Response FiltersFilters

The transfer function is given by

The length of Impulse Response is N

All poles are at . Zeros can be placed anywhere on

the z-plane

1

0).()(

N

n

nznhzH

0z

Page 17: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

17

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR: Linear phaseFIR: Linear phase

For phase linearity the FIR transfer function must have zeros outside the unit circle

Page 18: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

18

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR: Linear phaseFIR: Linear phase To develop expression for phase

response set transfer function (order n)

In factored form

Where , is real & zeros occur in conjugates

nnzhzhzhhzH ...)( 2

21

10

)1().1()( 12

1

11

1

zzKzH i

n

ii

n

i

1,1 ii K

Page 19: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

19

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR: Linear phaseFIR: Linear phase

Let where

Thus

)()()( 21 zNzKNzH

)1ln()1ln()ln())(ln(2

1

11

1

1

n

ii

n

ii zzKzH

)1()( 11

11

zzN i

n

i )1()( 12

12

zzN i

n

i

Page 20: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

20

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR: Linear phaseFIR: Linear phase

Expand in a Laurent Series convergent within the unit circle

To do so modify the second sum as )

11ln()ln()1ln(

2

1

12

1

12

1zzzi

n

ii

n

ii

n

i

Page 21: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

21

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR: Linear phaseFIR: Linear phase

So that

Thus

where

)1

1ln()1ln()ln()ln())(ln(2

1

1

1

12

n

i i

n

ii zzznKzH

mNm

m

mNm z

ms

zms

znKzH2

1

1

2 )ln()ln())(ln(

1

1

1n

i

mi

Nms

1

1

2n

i

mi

Nms

Page 22: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

22

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR: Linear phaseFIR: Linear phase

are the root moments of the minimum phase component

are the inverse root moments of the maximum phase component

Now on the unit circle we haveand

jez

)()()( jj eAeH

1Nms

2Nms

Page 23: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

23

AGC

DSP

AGC

DSP

Professor A G Constantinides

Fundamental RelationshipsFundamental Relationships

hence (note Fourier form)

jmNm

m

jmNmj e

ms

ems

jnKeH2

1

1

2)ln())(ln(

)())(ln())(ln())(ln( )( jAeAeH jj

mms

ms

KANm

m

Nm cos)()ln())(ln(

2

1

1

mms

ms

nNm

m

Nm sin)()(

2

1

1

2

Page 24: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

24

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR: Linear phaseFIR: Linear phase Thus for linear phase the second term in

the fundamental phase relationship must be identically zero for all index values.

Hence 1) the maximum phase factor has zeros

which are the inverses of the those of the minimum phase factor

2) the phase response is linear with group delay (normalised) equal to the number of zeros outside the unit circle

Page 25: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

25

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR: Linear phaseFIR: Linear phase It follows that zeros of linear phase

FIR trasfer functions not on the circumference of the unit circle occur in the form 1 ij

ie

Page 26: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

26

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR: Linear phaseFIR: Linear phase For Linear Phase  t.f. (order N-1) so that for N even:

)1()( nNhnh

1

2

12

0).().()(

N

Nn

nN

n

n znhznhzH

12

0

)1(12

0).1().(

N

n

nNN

n

n znNhznh

12

0)(

N

n

mn zznh nNm 1

Page 27: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

27

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR: Linear phaseFIR: Linear phase for N odd:

I) On we have for N even, and +ve sign

1

21

0

21

21

).()(

N

n

Nmn z

NhzznhzH

1: zC

12

0

21

21

cos).(2.)(N

n

NTj

Tj NnTnheeH

Page 28: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

28

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR: Linear phaseFIR: Linear phase II) While for –ve sign

[Note: antisymmetric case adds rads to phase, with discontinuity at ]

III) For N odd with +ve sign

12

0

21

21

sin).(2.)(N

n

NTj

Tj NnTnhjeeH

2/0

21

)( 21

NheeH

NTj

Tj

23

0 21

cos).(2

N

n

NnTnh

Page 29: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

29

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR: Linear phaseFIR: Linear phase IV) While with a –ve sign

[Notice that for the antisymmetric case to have linear phase we require

The phase discontinuity is as for N even]

2

3

0

21

21

sin).(.2)(

N

n

NTj

Tj NnTnhjeeH

.02

1

Nh

Page 30: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

30

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR: Linear phaseFIR: Linear phase The cases most commonly used in

filter design are (I) and (III), for which the amplitude characteristic can be written as a polynomial in

2cos

T

Page 31: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

31

AGC

DSP

AGC

DSP

Professor A G Constantinides

Design of FIR filters: Design of FIR filters: WindowsWindows

(i) Start with ideal infinite duration (ii) Truncate to finite length. (This

produces unwanted ripples increasing in height near discontinuity.)

(iii) Modify toWeight w(n) is the window

)(nh

)().()(~

nwnhnh

Page 32: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

32

AGC

DSP

AGC

DSP

Professor A G Constantinides

WindowsWindowsCommonly used windows

Rectangular Bartlett Hann Hamming   Blackman

Kaiser

21 NnN

n21

Nn2

cos1

Nn2

cos46.054.0

Nn

Nn 4

cos08.02

cos5.042.0

)(1

21 0

2

0 JNn

J

Page 33: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

33

AGC

DSP

AGC

DSP

Professor A G Constantinides

Kaiser windowKaiser window Kaiser window

β Transition width (Hz)

Min. stop attn dB

2.12 1.5/N 30

4.54 2.9/N 50

6.76 4.3/N 70

8.96 5.7/N 90

Page 34: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

34

AGC

DSP

AGC

DSP

Professor A G Constantinides

ExampleExample• Lowpass filter of length 51 and 2/ c

0 0.2 0.4 0.6 0.8 1

-100

-50

0

/

Gai

n,

dB

Lowpass Filter Designed Using Hann window

0 0.2 0.4 0.6 0.8 1

-100

-50

0

/

Gai

n,

dB

Lowpass Filter Designed Using Hamming window

0 0.2 0.4 0.6 0.8 1

-100

-50

0

/

Gai

n, d

B

Lowpass Filter Designed Using Blackman window

Page 35: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

35

AGC

DSP

AGC

DSP

Professor A G Constantinides

Frequency Sampling MethodFrequency Sampling Method• In this approach we are given and

need to find

• This is an interpolation problem and the solution is given in the DFT part of the course

• It has similar problems to the windowing approach

1

0 12

.1

1).(

1)(

N

k kNj

N

ze

zkH

NzH

)(kH)(zH

Page 36: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

36

AGC

DSP

AGC

DSP

Professor A G Constantinides

Linear-Phase FIR Filter Linear-Phase FIR Filter Design by OptimisationDesign by Optimisation

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

Page 37: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

37

AGC

DSP

AGC

DSP

Professor A G Constantinides

Linear-Phase FIR Filter Linear-Phase FIR Filter Design by OptimisationDesign by Optimisation

Modified form of weighted error function

where

)]()()()[()( DAQW E

])()[()()()(

QDAQW

)](~)()[(~ DAW

)()()(~ QWW

)(/)()(~ QDD

Page 38: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

38

AGC

DSP

AGC

DSP

Professor A G Constantinides

Linear-Phase FIR Filter Linear-Phase FIR Filter Design by OptimisationDesign by Optimisation

Optimisation Problem - Determine which minimise the peak absolute value of

over the specified frequency bands After has been determined,

construct the original and hence h[n]

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

DkkaWL

k

E

][~ ka

R

)( jeA][~ ka

Page 39: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

39

AGC

DSP

AGC

DSP

Professor A G Constantinides

Linear-Phase FIR Filter Linear-Phase FIR Filter Design by OptimisationDesign by Optimisation

Solution is obtained via the Alternation Theorem

The optimal solution has equiripple behaviour consistent with the total number of available parameters.

Parks and McClellan used the Remez algorithm to develop a procedure for designing linear FIR digital filters.

Page 40: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

40

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR Digital Filter Order FIR Digital Filter Order EstimationEstimation

Kaiser’s Formula:

ie N is inversely proportional to transition band width and not on transition band location

2/)(6.14

)(log20 10

ps

spN

Page 41: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

41

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR Digital Filter Order FIR Digital Filter Order EstimationEstimation

Hermann-Rabiner-Chan’s Formula:

where

with

2/)(

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

ps

psspsp FDN

sppsp aaaD 1031022

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

])(log)(log[ 61052

104 aaa pp ]log[log),( 101021 spsp bbF

4761.0,07114.0,005309.0 321 aaa

4278.0,5941.0,00266.0 654 aaa

51244.0,01217.11 21 bb

Page 42: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

42

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR Digital Filter Order FIR Digital Filter Order EstimationEstimation

Formula valid for For , formula to be used is

obtained by interchanging and Both formulae provide only an

estimate of the required filter order N

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

sp sp

p s

Page 43: AGC DSP AGC DSP Professor A G Constantinides 1 Digital Filter Specifications Only the magnitude approximation problem Four basic types of ideal filters

43

AGC

DSP

AGC

DSP

Professor A G Constantinides

FIR Digital Filter Order FIR Digital Filter Order EstimationEstimation

Fred Harris’ guide:

where A is the attenuation in dB Then add about 10% to it

2/)(20 ps

AN