Sei sulla pagina 1di 43

AGC DSP

 

Digital Filter Specifications


Only the magnitude approximation problem Four basic types of ideal filters with magnitude responses as shown below (Piecewise flat)
HLP(e j[ ) 1

HHP ( j[ ) 1

T

[ c 0

[ [c T

T

HBP ( j[ ) 1 [

[ c HBS (e j[ ) 1

[c

[ T

 T [ c2 [ c1

[ c1 [ c2 T

 T [ c 2 [ c1

[ [ c1 [ c 2 T Professor A G Constantinides

AGC DSP

Digital Filter Specifications


These filters are unealisable because (one of the following is sufficient)  their impulse responses infinitely long noncausal  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.
Professor A G Constantinides 2

AGC DSP

Digital Filter Specifications


Consider the ideal LP response squared (same as actual LP response) j[
H LP( e ) 1

T

[ c

[c

T

[ c

[c

Professor A G Constantinides

AGC DSP

Digital 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
Professor A G Constantinides 4

AGC DSP

Digital Filter Specifications


A realisable response would effectively need to have an approximation of the delta functions in the differential This is a necessary condition

Professor A G Constantinides

AGC DSP

Digital Filter Specifications


For example the magnitude response of a digital lowpass filter may be given as indicated below

Professor A G Constantinides

AGC DSP

Digital Filter Specifications


In the passband 0 e [ e [ p we require that with a deviation s H p G (e j[ ) $ 1

1  H p e G (e ) e 1  H p , [ e [ p


j[

In the stopband [ s e [ e T we require that (e j[ ) $ 0 with a deviation H s

(e )

j[

Hs,

[s

Professor A G Constantinides

AGC DSP

Digital Filter Specifications


Filter specification parameters  [ - passband edge frequency p  [s - stopband edge frequency  Hp - peak ripple value in the passband H s - peak ripple value in the  stopband
Professor A G Constantinides 8

AGC DSP

Digital Filter Specifications




 

Practical specifications are often given in terms of loss function (in dB) j[ G ([ ) !  20 log10 G (e ) Peak passband ripple E p !  20 log10 (1  H p ) dB Minimum stopband attenuation s !  20 log10 (H s ) dB
Professor A G Constantinides 9

AGC DSP

Digital Filter Specifications


In practice, passband edge frequency F p and stopband edge frequency Fs are specified in Hz For digital filter design, normalized bandedge frequencies need to be computed from specifications in Hz using

; p 2T Fp [p ! ! ! 2T FpT FT FT ; s 2T Fs [s ! ! ! 2T Fs T FT FT

Professor A G Constantinides

10

AGC DSP

Digital Filter Specifications




Example - Let Fp ! 7 kHz, Fs ! 3 kHz, and FT ! 25 kHz Then 3 2T (7 v 10 ) ! 0.56T [p ! 3 25 v 10 2T (3 v 10 ) ! 0.24T [s ! 3 25 v10
Professor A G Constantinides 11

AGC DSP

Selection of Filter Type


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 z 1

p0  p1 z 1  p2 z  2  .  pM z  M H ( z) ! 1 2 N d 0  d1 z  d 2 z  .  d N z


H(z) must be stable and of lowest order N or M for reduced computational complexity
Professor A G Constantinides 12

AGC DSP

Selection of Filter Type


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

H ( z ) ! h[n] z
n!0


n

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: h[ n] ! h[ N  n] Professor A G Constantinides (More on this later) 13

AGC DSP

Selection 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
Professor A G Constantinides 14

AGC DSP

FIR Design
FIR 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
Professor A G Constantinides

15

AGC DSP

Finite Impulse Response Filters


The transfer function is given by
H ( z ) ! h( n).z
n!0 N 1
n

  

The length of Impulse Response is N All poles are at z ! 0 . Zeros can be placed anywhere on the zplane
Professor A G Constantinides 16

AGC DSP

FIR: Linear phase


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

Professor A G Constantinides

17

AGC DSP

FIR: Linear phase




To develop expression for phase response set transfer function (order n)


H ( z ) ! h0  h1 z 1  h2 z  2  ...  hn z  n

In factored form
H ( z ) ! K (1 E i z ). (1 F i z )
i !1 i !1 n1
1

n2

1

Where E i 1, Fi " 1 K , real & zeros occur in conjugates

is
18

Professor A G Constantinides

AGC DSP

FIR: Linear phase




Let H ( z ) ! KN1 ( z ) N 2 ( z ) where


N1 ( z ) ! (1 E i z )
i !1 n1
1

N 2 ( z ) ! (1 F i z )
i !1

n2

1

ln( H ( z )) ! ln( K )  ln(1  E i z 1 )  ln(1  F i z 1 )


i !1 i !1
Professor A G Constantinides 19

Thus

n1

n2

AGC DSP

FIR: Linear phase


Expand in a Laurent Series convergent within the unit circle  To do so modify the second sum as


1 ln(1 Fi z ) ! ln(Fi z ) ln(1  z ) Fi i !1 i !1 i !1


1 1

n2

n2

n2

Professor A G Constantinides

20

AGC DSP

FIR: Linear phase




So that
n1
1

1 ln(H ( z)) ! ln(K )  n2 ln(z) ln(1  Ei z ) ln(1  z) Fi i !1 i !1




n2

Thus

ln(H ( z)) ! ln(K )  n2 ln(z) 




N1 sm

m

m!1

m
m Fi i !1

N2 sm

where
N1 sm

m E i i !1

n1

N2 s m

n1

Professor A G Constantinides

21

AGC DSP

FIR: Linear phase


N1  sm

are the root moments of the minimum phase component N2 s m are the inverse root moments of the maximum phase component Now on the unit circle we have z ! e jU and H (e jU ) ! A(U )e jJ (U )
Professor A G Constantinides

22

AGC DSP

Fundamental Relationships
N N2 sm1  jmU s m jmU e e ln( H (e jU )) ! ln( K )  jn2U   m m !1 m g

ln( H ( e jU )) ! ln( A (U ) e jJ (U ) ) ! ln( A (U ))  j J (U )




hence (note Fourier form)


ln( A (U )) ! ln( K )  (
m !1
g g

N1 sm

N2 s m

) cos m U

N N2 sm 1 s m  J (U ) !  n 2U  ( ) sin m U m m !1 m
Professor A G Constantinides 23

AGC DSP

FIR: 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 Professor A G Constantinides

 

24

AGC DSP

FIR: Linear phase


It follows that zeros of linear phase FIR trasfer functions not on the circumference of the unit circle occur in the form s jU i s1

?V e A
i

Professor A G Constantinides

25

AGC DSP

FIR: Linear phase


For Linear Phase t.f. (order N-1)
h ( n ) ! h( N  1  n )

  

so that for N even: N


2 1 n n!0
N 2
1

H ( z ) ! h ( n ). z

N 1

n h ( n ). z 2

n! N
N 2

! h ( n ). z  n s h ( N  1  n ). z  ( N 1 n )
n!0 N 2
1

1

n!0

! h(n) z n s z m
n!0

m ! N  1A G n  Constantinides Professor

26

AGC DSP

FIR: Linear phase


for N odd:
H ( z ) ! h(n). z
n!0 N 1 1 2
N 1  2

n

sz

m

N  1 z  h 2

I) On C : z ! 1 we have for N even, and +ve sign


H (e
j[ T

)!e

N 1 N 1  j[T 2 2

N  1 . 2h( n). cos [T n  2 n !0


Professor A G Constantinides 27

AGC DSP

FIR: Linear phase


II) While for ve sign
H (e
j[ T

)!e

N 1 N 1  j[ T 2 2

n  N  1 . j 2 h ( n ). sin [ T 2 n!0

[Note: antisymmetric case adds T / 2 rads to phase, with discontinuity at [ ! 0 ] III) For N odd with +ve sign
H (e
j[ T

) ! e

N 1  j[ T 2
N 3 2

N 1 h 2

N  1  2 h ( n ). cos [ T n  2 n!0 Professor A G Constantinides

28

AGC DSP

FIR: Linear phase


IV) While with a ve sign
N 1  j[ T 2

H ( e j[ T ) ! e

n  N  1 2 j .h ( n ). sin [ T 2 n !0
N 3 2

[Notice that for the antisymmetric case to have linear phase we require
N  1 ! 0. h 2

The phase discontinuity is as for N even] Professor A G Constantinides

29

AGC DSP

FIR: 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
[T cos 2

Professor A G Constantinides

30

AGC DSP

Design of FIR filters: Windows

(i) Start with ideal infinite duration _h(n)a (ii) Truncate to finite length. (This produces unwanted ripples increasing in height near discontinuity.) ~ (iii) Modify to h ( n) ! h(n).w( n) Weight w(n) is the window

Professor A G Constantinides

31

AGC DSP

Windows
Commonly used windows 2 n 1 Rectangular n N 2T n Bartlett 1  cos N Hann 2T n Hamming 0 . 54  0 .46 cos N Blackman Kaiser
N 1 2

       

2 T n  0 . 08 cos 4 T n 0 . 42  0 . 5 cos N N
J 0 F 2n 1 N 1
2

J 0 (F ) Professor A G Constantinides

32

AGC DSP

Kaiser window
Kaiser window
Transition Min. stop width (Hz) attn dB 1.5/N 30 2.9/N 4.3/N 5.7/N 50 70 90
Professor A G Constantinides 33

2.12 4.54 6.76 8.96

AGC DSP

Example
[c ! T / 2
L ow pass Filter D esigned U sing H amming w indow 0 Gain, dB
0 0.2 0.4 [ /T 0.6 0.8 1

Lowpass filter of length 51 and


L ow pass F ilter D esigned U sing H ann w indow 0 Gain, dB

-50

-50

-100

-100 0 0.2 0.4 [ /T 0.6 0.8 1

Lowpass Filter Designed Using Blackman window 0

Gain, dB

-50

-100 0 0.2 0.4 [/T 0.6 0.8 1

Professor A G Constantinides

34

AGC DSP

Frequency Sampling Method

In this approach we are given H (k ) and need to find H (z ) This is an interpolation problem and the solution is given in the DFT part of the course N
1 N 1 1 z H ( z ) ! H (k ). 2T N k !0 j k 1  e N .z 1

It has similar problems to the windowing Professor A G Constantinides approach

35

AGC DSP

LinearLinear-Phase FIR Filter Design by Optimisation




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


expressed as H ([ ) ! Q ([ ) A([ ) 1, where [/2), cos( Q ([ ) ! sin([ ), [ / 2), sin(
or Type 1 or Type 2 or Type 3 or Type 4
Professor A G Constantinides 36

AGC DSP

LinearLinear-Phase FIR Filter Design by Optimisation


Modified form of weighted error function E ([ ) ! W ([ )[Q([ ) A([ )  D([ )] ([ ) ! W ([ )Q ([ )[ A([ )  Q ([ ) ] ! W ([ )[ A([ )  D ([ )] where
W ([ ) ! W ([ )Q ([ ) ~ D ([ ) ! D ([ ) / Q ([ )
Professor A G Constantinides 37

AGC DSP

LinearLinear-Phase FIR Filter Design by Optimisation


~ a [k ] Optimisation Problem - Determine which minimise the peak absolute value ~ ~ of E ([ ) ! W ([ )[ L a [ k ] cos([ k)  D([ )] ~
k !0

over the specified frequency bands [ R ~ a [k ] has been determined, After j[ construct the original A(e ) and hence h[n]
Professor A G Constantinides 38

AGC DSP

LinearLinear-Phase FIR Filter Design 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.
Professor A G Constantinides 39

AGC DSP

FIR Digital Filter Order Estimation


N$  20 log10 ( H pH s ) 14.6([ s  [ p ) / 2T

Kaiser s Formula:

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

Professor A G Constantinides

40

AGC DSP

FIR Digital Filter Order Estimation


Hermann-Rabiner-Chan s Formula: Dg (H p , H s )  F (H p , H s )[([ s  [ p ) / 2T ]2 N$ ([ s  [ p ) / 2T where
Dg (H p , H s ) ! [ a1 (log10 H p ) 2  a2 (log10 H p )  a3 ] log10 H s  [a4 (log10 H p ) 2  a5 (log10 H p )  a6 ] F (H p , H s ) ! b1  b2 [log10 H p  log10 H s ] with a1 ! 0.005309, a2 ! 0.07114, a3 ! 0.4761 a4 ! 0.00266, a5 ! 0.5941, a6 ! 0.4278 b1 ! 11.01217 , b2 ! 0.51244 A G Constantinides Professor

41

AGC DSP

FIR Digital Filter Order Estimation


Formula valid for H p u H s For H p H s , formula to be used is obtained by interchanging H p and H s Both formulae provide only an estimate of the required filter order N If specifications are not met, increase filter order until they are met
Professor A G Constantinides

 

42

AGC DSP

FIR Digital Filter Order Estimation


Fred Harris guide:
A N$ 20([s  [ p ) / 2T

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

Professor A G Constantinides

43

Potrebbero piacerti anche