You are on page 1of 21

Topics: T i

1. Linear Phase FIR Digital Filter. Introduction 2. Linear-Phase FIR Digital Filter Design: Window (Windowing) M th d Wi d (Wi d i ) Method
1

Topic: T i
Linear Phase FIR Digital Filter Introduction Filter.
advantages and disadvantages of linear phase FIR digital g g p g filters, linear phase conditions for FIR filters, four groups/kinds of linear phase FIR digital filters.

Special operations

Topic: T i
Linear-Phase Linear Phase FIR Digital Filter Design: Window (Windowing) Method
basic principles and algorithms, method description in time- and frequency-domain, Example A.: FIR filter design-rectangular window application, Gibbs phenomenon and different windowing applications, p g pp Example B.: FIR filter design at different window applications.
3

Differentiation:

y (t ) =
Integration:

dx(t ) dt
t

Y ( j ) = j X ( j )

y (t ) = x( ) d

Y ( j ) =

1 X ( j ) + X (0) ( ) j

Digital Filter Design


Objective - Determination of a realizable transfer f ti G( ) approximating a given t f function G(z) i ti i frequency response specification. Digital filter design is the process of deriving ( ) the transfer function G(z). Two possibilities: IIR or FIR. If an IIR filter is desired G(z) should be a desired, stable real rational function
5

Digital Filter Specifications


The magnitude and/or the phase (delay) response is specified for the design of a digital filter for most applications g pp In most practical applications, the problem of interest is the de elopment of a reali able development realizable approximation to a given magnitude response specification
6

Digital Filter Specifications g p


In this course we shall discuss only the magnitude approximation problem There are four basic types of ideal filters with magnitude responses as shown below
HLP( j ) (e 1

Digital Filter Specifications


As the impulse response corresponding to p p p g each of these ideal filters is noncausal and of infinite length these filters are not length, realizable In practice, the magnitude response i h i d specifications of a digital filter in the passband and in the stopband are given with some acceptable tolerances In addition, a transition band is specified between the passband and stopband b h b d d b d
7 8

HHP ( j ) (e 1

c 0

HBP ( j ) (e 1

HBS

(e j ) 1

c2 c1

c1 c2

c2 c1

c1 c2

Digital Filter Specifications


For example, the magnitude response| G (e j ) | p , g p of a digital lowpass filter may be given as indicated below

Digital Filter Specifications


As indicated in the figure, in the passband, defined by 0 p , we require that G ( e j ) 1 with an error p , i.e., ,
1 p G ( e j ) 1 + p , p

In the stopband, defined by s , we require that G (e j ) 0 with an error s , i.e., ie G ( e j ) s , s


9 10

Digital Filter Specifications


p - passband edge frequency s - stopband edge frequency p - peak ripple value in the passband s - peak ripple value in the stopband G (e j ) is a periodic function of and the magnitude response of a real-coefficient digital filter is an even function of g As a result, filter specifications are given only for the frequency range 0 l f th f
11

A. A Comments on phase response: The phase response of ideal filters is linear:

( ) = t0
B. Comments on group delay function: Group delay function of ideal filters is constant:

( ) =

d ( ) d = [ t0 ] = t0 = const. d d

C. Note: It will be proved for linear phase FIR filters:

t0 =

M 1 2

12

All-Pass All Pass Filters: A filter is called all-pass if its magnitude all pass response is identically a positive constant ( H (e j ) = const). at all frequencies. The phase response of an all-pass filter frequencies all pass is not restricted and is allowed to vary arbitrarily as a function of the frequency. frequency

In general, a rational filter is all-pass if only if it has the same number of poles and zeros (including multiplicities), and each zero is the conjugate inverse of a corresponding pole: zk=1/pk.
Example:

Linear Phase FIR Digital Filter. Introduction

0.8 z 1 H ( z) = 1 0.8 z 1

z1 = 1/ 0.8

p1 = 0.8
13 14

z1 = 1/ 0.8 = 1/ p1

FIR di it l filt h a fi it number of non-zero digital filter has finite b f coefficients of its impulse response:
M N : h(n) = 0 for n > M Mathematical model of a causal FIR digital filter: y ( n) = h( k ) x ( n k )
k =0 M 1

The advantages of FIR filters (1):

FIR

filters with exactly linear phase can be easily designed. This simplifies the approximation problem, in many cases, when one is only interested in designing of a filter that approximates an arbitrary magnitude response. Linear phase filters are important for applications where frequency dispersion due to nonlinear phase is harmful (e.g. speech processing and data transmission). implementing FIR filters. These include both nonrecursive and recursive realizations realizations.
16

Digital FIR filters cannot be derived from analogue g g filters, since causal analogue filters cannot have a finite impulse response. In many digital signal processing applications, FIR filters are preferred over their IIR 15 counterparts.

There are computationally efficient realizations for

The advantages of FIR filters (2):

The disadvantages of FIR filters:

FIR filters realized non-recursively are inherently stable and free of limit cycle oscillations when implemented on a finite-word length digital system. The output noise due to multiplication round off errors in FIR filters is usually very low and the sensitivity to variations in the filter coefficients is also low. low Excellent design methods are available for various kinds of FIR filters with arbitrary specifications.
17

The relative computational complexity of FIR filter is p p y


higher than that of IIR filters. This situation can be met especially in applications demanding narrow p y pp g transition bands or if it is required to approximate sharp cut off frequency. The cost of implementation of an FIR q y p filter can be reduced e.g. by using multiplier-efficient realizations, fast convolution algorithms and multirate , g filtering.

Th group d l f ti of li The delay function f linear phase FIR filters h filt


need not always be an integer number of samples.
18

Frequency Response of Linear Phase FIR Digital q y p g Filters

The linear phase condition is obtained by imposing symmetry conditions on the impulse response of the filter. In particular, we consider two different symmetry conditions for h(k): A. A Symmetrical impulse response:

FIR filter of length M : y ( n) = h( k ) x ( n k )


k =0 M 1

H (e ) = h ( k )e
j k =0

M 1

j k

h(k ) = h( M 1 k ) for k = 0,1,2,K, M 1


B. Antisymmetrical impulse response:

h(k ) = h( M 1 k ) for k = 0,1,2,K, M 1


The length of the impulse response of the FIR filter (M) can be even or odd. Then, the four cases of linear phase FIR filters can be obtained.
20

19

Symmetrical Impulse Response, M: Even

h( n)

h(7)=h(8) h(7) h(8)

M = 16

Example: M=4 (even), symmetrical impulse response

M 1 = 4 1 = 3 h(0) = h(3)
h(2) h(13) h(2)=h(13)

k = 0,1,2,3 h(1) = h(2) M 4 = =2 2 2

M 4 1 = 1 = 1 2 2
h(1) h(14) h(1)=h(14) h(0) h(15) h(0)=h(15)

k =0,1,2,K, M 1 =0 1 2 h(0) = h( M 1), h(1) = h( M 2), h(2) = h( M 3),K, M M h 1 = h 2 2

21

22

H (e ) = h ( k )e
j k =0

M 1

j k

= h( k )e
k =0

4 1

j k

= h ( k )e
k =0

j k

H (e j ) = h(k )e jk =
k =0
M M 1 2 1 j 2 k =0

M 1

M 1 2 k =0

h( k ) e
e

j k

+e

j ( M 1 k )

H (e j ) = h(0)e j 0 + h(1)e j 1 + h(2)e j 2 + h(3)e j 3 =


= h(0) ( e j 0 + e j 3 ) + h(1) ( e j 1 + e j 2 ) = = h(k ) e j k + e k =0 End. End =
M 1 2 1 j ( 4 1 k )

= 2e

h( k )
M 1 2

M 1 j k 2

+e 2

M 1 j k 2

H (e j ) = e

M 1 2

= for M = 4 4.
23

M 1 2 h(k )cos k 2 k =0

Here, the real-valued frequency response is given by M 1 H r ( ) = 2 h(k ) )cos k 2 k =0


24

h(k ) e jk + e k =0

j ( M 1 k )

M 1 2

H (e ) = e

M 1 2

H r ( ) f for H r ( ) 0 f for H r ( ) < 0 d ( ) M 1 = d 2 We observe that the phase response is a linear function of provided that H r ( ) is positive or negative. When H r ( ) changes the sign from positive to negative (or vice versa), the phase undergoes an abrupt change of radians radians. If these phase changes occur outside the pass-band of the filter we do not care, since the desired signal passing through the filter has no frequency content in the stopband.
26

M 1 j 2 H r ( ) e = M 1 H ( ) e j 2 + r

H (e j ) = H r ( )

( ) =

M 1 2 ( ) = M 1 2

for H r ( ) 0 for H r ( ) < 0


25

Symmetrical Impulse Response, M: Odd

h( n)

h(7)=h(7) h(7) h(7)

M = 15

Example: M=5 (odd), symmetrical impulse response p ( ), y p p

M 1 = 4
h(6)=h(8)

k = 0,1,2,3,4 h(1) = h(3) h(2) = h(2) 2= M 1 2

h(0) = h(4) 1=

53 M 3 = 2 2

h(1)=h(13) h(1) h(13) h(0)=h(14)

27

28

H (e ) = h ( k )e
j k =0

M 1

j k

=
M 3 2 k =0

H (e ) = e
j k

M 1 2

H r ( ) = for H r ( ) 0 for H r ( ) < 0

M 1 M 1 j 2 = h + e 2

h( k ) e

+e

j ( M 1 k )

M 1 j 2 H r ( ) e = M 1 H ( ) e j 2 + r

=e

M 1 j 2

M 1 M 1 M 3 j k j k 2 2 2 e +e M 1 h 2 + 2 h( k ) = 2 k =0

H (e j ) = H r ( ) M 1 2 ( ) = M 1 2

( ) =

d ( ) M 1 = d 2

=e

M 1 2

M 3 2 M 1 M 1 h + 2 h(k )cos k 2 2 k =0 the real-valued frequency response H r (29 )

for H r ( ) 0 for f H r ( ) < 0


30

Antisymmetrical Impulse Response, M: Even h( n) M = 16

Example: M=4 (even) antisymmetrical impulse response (even),

M 1 = 3
h(1)=-h(14)

k = 0,1,2,3

h(0) = h(3) h(1) = h(2) 4 M 1 = 1 = 1 2 2 k = 0,1,2,K, M 1 ,, , h(0) = h( M 1), h(1) = h( M 2), h(2) = h( M 3),K,
h(7)=-h(8)

h(0)=-h(15)

M M h 1 = h 2 2

31

32

H (e ) = h ( k )e
j k =0

M 1

j k

M 1 2 k =0

h( k ) e
M 1 j k 2

j k

j ( M 1 k )

H (e ) = e

M 1 +j 2 2

H r ( ) = for H r ( ) 0 for H r ( ) < 0

= 2 je

M M 1 2 1 j 2 k =0

h( k )
M 1 2

e 2j

M 1 j k 2

M 1 j +j 2 2 H r ( ) e = M 1 3 H ( ) e j 2 + j 2 r

H (e j ) = H r ( )

( ) =

=e

M 1 +j 2 2

M 1 2 h(k )sin k 2 k =0

d ( ) M 1 = d 2

the real-valued frequency response H r ( )


33

M 1 + 2 2 ( ) = M 1 + 3 2 2

for H r ( ) 0 for f H r ( ) < 0


34

3.2.4. Antisymmetrical Impulse Response, M: Odd

Here, the real-valued frequency response is given by M 1 H r ( ) = 2 h(k )sin k 2 k =0 M 1 H r (0) = 2 h(k )sin 0 k=0 2 k =0
M 1 2 M 1 2

h( n)

M = 17
h(1)=-h(15)

Low-pass and band-stop filters cannot possess an 0. antisymetrical impulse response because H r (0) 0

! !
35

h(0)=-h(16)

h(8) h(8) 0 h(8)=-h(8)=0

h(7)=-h(9)

36

Example: M=5 (odd) antisymmetrical impulse response M 5 (odd),

M 1 = 4, k = 0,1,2,3,4 h(0) = h(4), h(1) = h(3), h(2) = h(2) h(2) = 0 ! 53 M 3 5 1 M 1 1= = 2= = 2 2 2 2 k = 0,1,2,K, M 1 h(0) = h( M 1), h(1) = h( M 2), h(2) = h( M 3),K, 1) 2) 3)

H (e j ) = h(k )e jk =
k =0

M 1

M 3 2 k =0

h( k ) e
e
M 1 j k 2

j k

j ( M 1 k )

= 2 je

M 1 j 2

M 3 2 k =0

h( k )
M 3 2

e 2j

M 1 j k 2

M 3 M +1 h = h , 2 2 M 1 M 1 h = h =0 2 2
M 1 +j 2 2

=e

M 1 j + 2 2

M 1 2 h(k )sin k 2 k =0

the real valued frequency response H r ( ) real-valued


37 38

H (e ) = e

H r ( ) = for H r ( ) 0 f for H r ( ) < 0 Here, the real-valued frequency response is given by


M 3 2

M 1 j +j 2 2 H r ( ) e = M 1 3 H ( ) e j 2 + j 2 r

M 1 H r ( ) = 2 h(k )sin k 2 k =0 M 1 H r (0) = 2 h(k )sin 0 k=0 2 k =0


M 1 2

H (e j ) = H r ( )

d ( ) M 1 = ( ) = d 2 for H r ( ) 0 for H r ( ) < 0


39

M 1 + 2 2 ( ) = M 1 + 3 2 2

! !
40

Low-pass and band-stop filters cannot possess an 0. antisymetrical impulse response because H r (0) 0

Basic Principles and Algorithms

Linear-Phase FIR Digital Filter Design


Window (Windowing) Method

Since H (e j ) , the frequency response of any digital filter is a periodic in frequency, it can be expended in a Fourier series. The resultant series is of the form H (e ) =
j

k =

h ( k )e

j k

1 h( n) = 2

H (e

)e j n d

The coefficients h(k ) of the Fourier series are easily recognized as being identical to the impulse response of a digital filter. There are two difficulties with the application of the above given expressions for designing of FIR digital filters:
41 42

1. 1 The filter impulse response is infinite in duration duration, since the above given summation extends to . H (e ) = h (k )e 2. The filter is unrealizable (non-causal) because the i.e. impulse response begins at ; i e no finite amount of delay can make the impulse response realizable. j H (e ) = h(k )e jk k = Hence the filter resulting from a Fourier series representation of H (e j ) is an unrealizable (noncausal) IIR filter. In spite of that fact, the causal FIR filter can be designed by the approach illustrated in the next figures.
j j k k =

Summary
Non-Causal IIR filter: y ( n) =
k =

h( k ) x ( n k )
1 h( n) = 2

H (e ) =

k =
j

h ( k )e

j k

H (e

)e j n d

Causal filter : FIR filter :


M 1 k =0

h(k ) = 0 for k < 0


M N : h(n) = 0 for n > M

Causal FIR filter of length M: y ( n) = h( k ) x ( n k ) H (e ) = h(k )e j k


j k =0 M 1
44

43

Window (Windowing) Method: Time-Domain ( ) n (, ) w ( n )hnR for N n N ;


w ( n ) = 0 for n > N

Windows (Windowing) Method: Frequency-Domain H ( e j)) H (e ) ( No i l ! N ripple!


j j

H ( e j ) = FT [h(n)] W ( e j )
Side lobes Central (main) lobe

w(n) M =7 red f (n) = h(n) w(n) red d g (n) = f (n 3) g ( n) f ( n)

1 Rectangularj jn window h( n) = e H (= 3 )e dn 2 N

W ( e j ) = FT [ w(n)] F ( e j )

n
Ripple! pp

n
45

f (n) = h(n) w(n)

F ( e j ) = H ( e j ) * W ( e j )
46

Gibbs Phenomenon

Filter Design: Low Pass Filter Design

FIR Filter Design g


Approaches: 1. FIR Filters by Windowing Ideal Low Pass Filter
j e , c H d (e j ) = 0 c 0, hd [n] = sin(c (n )) N 1 , = (n ) 2

Problem: Given 1 , 2 , p and s , find the lowest complexity filter that meets specification Two Choices 1. 1 IIR Filt (Infinite Impulse Response, Filters (I fi it I l R 2. FIR Filters (Finite Impulse Response,
H (z) = B (z) A(z) H (z) = B (z)

FIR Filter Design ( g (Cont.) )


For Linear Phase = N 1 2

Rectangular Windowing l i d i
h[n] = hd [n]wr [n]
Where

1, 0 n N 1 wr [n] = 0, otherwise 1 H (e ) = 2
j

Unit sample response of an ideal lowpass filter

H d (e j )Wr (e j ( ) )d
Prof Rao

Effects of Windowing g

W R (e ) =

e
n=0

N 1

=e

j ( N 1) 2

sin

(N )
2 2

sin

Illustration of type of approximation obtained at a discontinuity of the ideal frequency response.


Prof Rao

Rectangular Window Frequency g q y Response


Truncation is just pre-multiplication by a rectangular window

Magnitude of Rectangular Window Frequency Response q y p

Increasing the dimension of the g window

The width of the main lobe decreases as M increases The Area under sidelobes remains constant as M increases. The Width of the transition region increases with increase in width of the mainlobe of window..

Increasing the dimension of the g window


Transition region gets smaller but the ripple remains. Problem: Sharp di P bl Sh discontinuity of rectangular ti it f t l windows!!

Solution to Sharp Discontinuity of p y Rectangular Window


Use windows with no abrupt discontinuity in their ti d th i time domain response and consequently i d tl low side-lobes in their frequency response. In this case, the reduced ripple comes at the expense of a wider transition region but this p g However, this can be compensated for by increasing the length of the filter. filter

Example: p

By the impulse response truncation method (by the windowing method at rectangular window application) design a low-pass filter of order N=15 with pass-band cut off frequency (pass-band edge frequency) f 0 = 1kHz . Frequency sampling is f S = 4 kHz .
Solution: f S = 4 kHz

1 h( n) = 2

H (e
jn

)e

jn

1 d = 2

/2
/2

1e j n d =

1 e = 2 jn / 2

/2

jn jn 2 1 e e 2 = n 2 j 2j

f 0 = 1kHz

0 =

1 j Low-pass filter: H (e ) = 0

2 2 fo = .1.103 = 1 10 fs 4.103 2 for f 0 = for > 0 =

2 2
59

1 e n

jn

e 2j

jn

sin n 2 = n
60

Problem: Solution :

sin n 2 for n = 0 0 h( n) = n 0

?
Rectangular window application:

1 h(0) = 2 1 = 2 =
/2
/2

H (e

)e j 0 d =

1d 1d =

1 /2 [ ] / 2 = 2

1 2

2 2 = 0.5
61

f ( n) = h( n)

for n < 7,7 >


62

Example: Impulse Responses n < 7,7 > h( n) = f ( n)

Example: Magnitude Response


G ( e j )

=
0

n
Example: Phase Response E l Ph R

g ( n)
g(0)=f(-7) g(1)=f(-6)

n < 0,14 >


g(14) f(7) g(14)=f(7)

( )

=
0

63

64

Gibbs Phenomenon and Different Windowing Example: Gibbs phenomenon illustration


Direct truncation of impulse response leads to well known Gibbs phenomenon phenomenon. It manifests itself as a fixed percentage overshoot and ripple before and after di b f d ft discontinuity i th f ti it in the frequency response. E.g. standard filters, the largest ripple in the frequency response is about 18% of the size of discontinuity and its amplitude does not decrease with increasing impulse response duration i e including more and more terms in the Fourier i.e. series does not decrease the amplitude of the largest ripple. Instead, the I t d th overshoot i confined t a smaller and smaller h t is fi d to ll d ll frequency range as is increased.
65 66

Next figures: Magnitude responses of the N-th order FIR low-pass digital filters with normalized cut off frequency / 2 , for N=5 25 50 100 The figures N 5, 25, 50, 100. confirm the above given statements concerning the Gibbs phenomenon phenomenon.

Low-Pass FIR Filter: Rectangular Window Application N =5 N = 25 G ( e j )


G ( e j )

Comments: The major effect is that discontinuities of H (e j )became j transition bands between values on the either side of the discontinuity. Since the final frequency response of the filter is the circular convolution of the ideal frequency response with the windows frequency response

/2
G ( e j )

N = 50

/2
G ( e j )

N = 100

F (e j ) = H (e j ) * W (e j )

it is clear that the width of these transition bands depends on the width of the main (central) lobe of W (e j ) .

/2

/2

67

68

Some Commonly Used Windows The second effect of the windowing is that the ripple from the side lobes produces a ripple in the resulting frequency response response.

M 1 2 w(n) R for N n N N=

w(n) = 0 for n > N

Rectangular: w(n) = 1

Bartlett: w(n) = 1

n N +1

a) Small width of the main lobe of the frequency response of the window containing as much the total energy as possible. b) Side lobes of the frequency response that decrease in energy rapidly as tends to .
69

Hann: w(n) =

2 n 2N + 1 2 n 4 n + 0.08cos 70 Blackmann: w(n) = 0.42 0.5cos 2N + 1 2N + 1


Hamming: w(n) = 0.54 0.46cos

1 2 n 1 cos 2 2 N + 1

Windows Magnitude of Frequency g q y Response

Properties of Commonly Used Windows p y Rectangular


1, 0 n M , w[n] = 0, otherwise

Bartlett (triangular)

2 n / M , 0 n M 2 w[ n ] = 2 2 n / M , M / 2 n M 0, otherwise Hanning Hamming 0.5 0.5cos( n / M) 0 n M 2 ), 0.54 0.46cos(2n / M ), 0 n M w[n] = w[n] = 71 0, otherwise 0, otherwise

Summary of Windows y Characteristics

d Given specifications: 1 , 2 , p and We employ the following procedure

Window Based Design


s
= min(1 , 2 ) = p s

1. Compute

We see clearly that a wider transition region (wider mainlobe) is compensated by much lower side-lobes and thus less ripples.

Compute20 l 10 and select window type log Choose M, the filter order, to meet transition width Filter Coefficients h[ n ] = hd [ n ]w[ n ], 0 n M are given by
where c = ( p + s ) / 2 2,
74

FIR Filter length estimation


Window type Rectangle Hanning Hamming Blackman Window length M 0.9/f M=0 9/f M= 3.1/ f M= 3.3/ f M=5.5/ f

Kaiser Window
w[n ] = I 0 [ (1 ( n

I0 ( )

) ) ]

1 2 2

, 0 n M , = M / 2

I 0 (.)is zeroth order modified Bessel function of the First Kind 2 (.5 x) m I ( x) = m! m =0 controls sidelobe level (Stopband Attenuation) Th filter order M controls the Mainlobe width The fil d l h M i l b id h

76

Kaiser Window based design


Design Method: define = s p

A = 20 log10 , where = min( 1 , 2 ) Choose as


.1102( A 8.7) , A > 50 = .5842( A 21)0.4 + .07886( A 21), 21 A 50 0, A < 21 A8 M= 77 2.285

78

Example: p

Normalized frequency ( )

By the windowing method, design a low-pass filter of kHz order N 55 with pass-band cut off frequency f 0 = 1kH . d N=55 ith b d t ff f Frequency sampling is f S = 4 kHz.
Solution: For the results see the next figures. figures

79

80

Example:FIR Filter Design by Windowing Method

20 * log10 H ( e j ) N=55 N 55
[dB]

Example:FIR Filter Design by Windowing Method

20 * log10 H ( e j ) [dB]

Rectangular Window

Kaiser Window: alfa=3 Kaiser Window: alfa=10 Bartlett Window Kaiser Window: alfa=15 alfa 15 Kaiser Window: alfa=30 Hamming Window

Rectangular Window l i d

81

82

You might also like