Lecture 2: February 27, 2007

Post on 20-Jan-2016

31 views 0 download

Tags:

description

Lecture 2: February 27, 2007. Topics:. 1. Introduction to Digital Filters. 2. Linear Phase FIR Digital Filter. Introduction. 3. Linear-Phase FIR Digital Filter Design: Window (Windowing) Method. Lecture 2: February 27, 2007. Topic:. 1. Introduction to Digital Filters. - PowerPoint PPT Presentation

Transcript of Lecture 2: February 27, 2007

1

Lecture 2: February 27, 2007

Topics:

2. Linear Phase FIR Digital Filter. Introduction

3. Linear-Phase FIR Digital Filter Design: Window (Windowing) Method

1. Introduction to Digital Filters

2

Lecture 2: February 27, 2007

Topic:1. Introduction to Digital Filters

• basic terminology and definitions: filtering, filter, analogue filtering, digital/discrete-time filtering and filters,

• frequency-selective filter classification,

• basic parameter specification for filter design.

3

Lecture 2: February 27, 2007

Topic:2. Linear Phase FIR Digital Filter. Introduction• advantages and disadvantages of linear phase FIR digital

filters,

• linear phase conditions for FIR filters,

• four groups/kinds of linear phase FIR digital filters.

4

Lecture 2: February 27, 2007

Topic:3. 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,

• Example B.: FIR filter design at different window applications.

5

2. Introduction to Digital Filters

2.1. Definitions of Basic Terms

6

Filtering: process of extraction of desired signal from noise

Filter: system performing filtering

Analogue filtering: filtering performed on continuous-time signals and yields continuous-time signals

Digital/discrete-time filtering: filtering performed on digital/discrete-time signals and yields digital/ discrete-time signals

7

Examples of filtering applications

• Received radio signals.

• Signals received by imaging sensors, such as television cameras or infrared imaging devices.

• Electrical signals measured from the human body (such as brain, heart or neurological signals).

A. Noise suppression

8

B. Enhancement of selected frequency range

• Treble and bass control or graphic equalizers in audio systems.

• Enhancement of edges in image processing.

C. Bandwith limiting

• Bandwidth limiting as a means of aliasing prevention in sampling.

• Application in FDMA communication systems (Frequency Division Multiple Access - FDMA).

9

D. Removal or attenuation of specific frequencies

• Blocking of the DC component of a signal.

• Attenuation of interference from powerline (50 Hz).

10

E. Special operations

Differentiation: ( )

( )dx t

y tdt

( ) ( )Y j j X j

Integration:

( ) ( )t

y t x d

1

( ) ( ) (0) ( )Y j X j Xj

Hilbert transform:1

( )h tt

( ) ( )H j j sgn

11

2.2. Filter Specifications

Low-Pass Filters: Low-pass filters are designed to pass low frequencies, from zero to a certain cut off frequency and to block high frequencies.

2.2.1. Ideal Filters

Ideal magnitude frequency response

0

jH e 1

0

12

2.2. Filter Specifications2.2.1. Ideal Filters

0

0

1 0, . .

0 ( , . .j for i e pass band

H efor i e stop band

Low-Pass Filters:

Ideal magnitude frequency response

0

jH e 1

0

13

High-Pass Filters: High-pass filters are designed to pass high frequencies, from a certain cut off frequency to , and to block low frequencies.

Ideal magnitude frequency response

0

jH e 1

0

14

High-Pass Filters:

0

0

0 0, ) . .

1 , . .j for i e stop band

H efor i e pass band

Ideal magnitude frequency response

0

jH e 1

0

15

Band-Pass Filters: Band-pass filters are designed to pass a certain frequency range, which does not include zero, and to block other frequencies.

Ideal magnitude frequency response

1

jH e

2

1

0

16

Band-Pass Filters:

1 2

1 2

0 0, ) ( , ) . .

1 , . .j for i e stop band

H efor i e pass band

Ideal magnitude frequency response

1

jH e

2

1

0

17

Band-Stop Filters: Band-stop filters are designed to block a certain frequency range, which does not include zero, and to pass other frequencies.

Ideal magnitude frequency response

2

jH e

1

1

0

18

Band-Stop Filters:

1 2

1 2

1 0, , ) . .

0 ( , ) . .j for i e pass band

H efor i e stop band

Ideal magnitude frequency response

2

jH e

1

1

0

19

Possible ideal magnitude frequency response

1

jH e

2 3 4 5 6

1

0

Multiband Filters: This type of filters generalizes the previous four types of filters in that it allows for different gains or attenuations in different frequency bands. A piecewise –constant multiband filter is characterized by the following parameters:

20

• A division of the frequency range to a finite union of intervals. Some of these intervals are pass bands, some are stop bands, and the remaining can be transition bands.

• A desired gain and a permitted tolerance for each pass band.

• An attenuation threshold for each stop band.Possible ideal magnitude frequency response

1

jH e

2 3 4 5 6

1

0

21

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

0( ) t

B. Comments on group delay function: Group delay function of ideal filters is constant:

0 0

( )( ) .

d dt t const

d d

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

0

1

2

Mt

22

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

Example: 1

1

0.8( )

1 0.8

zH z

z

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.

1 0.8p 1 1/ 0.8z

1 11/ 0.8 1/z p

( ) .jH e const

23

Differentiator: The ideal frequency response of a digital differentiator is

j jH e

T

Ideal normalized frequency response

jH e j

0

24

0

( ) 0 0

0

j

j

H e

j

Hilbert Transformer: The frequency response of an ideal Hilbert transformer is

Ideal normalized frequency response

jH e j

0

1

1

25

2.2.2. Practical (Real, Causal) Filters:

• pass band (bands),• stop band (bands),• transition band (bands),

• pass band ripple/ripples,

• stop band ripple/attenuation (ripples/attenuations).

• pass band cut off frequency/frequencies,

• stop band cut off frequency/frequencies,

Description by a Set of Parameters

26,1p ,2p,1s

,2s

pass bandstop bands

transition bands

jH e

27,1p ,2p,1s

,2s

1 p

1 p

:p pass-band ripple

s

:sstop-band ripple

(attenuation)

jH e

28

3. Linear Phase FIR Digital Filter. Introduction

3.1. Advantages and Disadvantages

of

Linear Phase FIR Digital Filters

29

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

FIR digital filter has a finite number of non-zero coefficients of its impulse response:

: ( ) 0M N h n for n M

Mathematical model of a causal FIR digital filter:1

0

( ) ( ) ( )M

k

y n h k x n k

30

• 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).

• There are computationally efficient realizations for implementing FIR filters. These include both non-recursive and recursive realizations.

The advantages of FIR filters (1):

31

• 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.

• Excellent design methods are available for various kinds of FIR filters with arbitrary specifications.

The advantages of FIR filters (2):

32

The disadvantages of FIR filters:

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

• The group delay function of linear phase FIR filters need not always be an integer number of samples.

33

3.2. Frequency Response of Linear Phase FIR Digital Filters

FIR filter of length M :

1

0

( ) ( )M

j j k

k

H e h k e

1

0

( ) ( ) ( )M

k

y n h k x n k

34

It will be shown that 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):

( ) ( 1 ) 0,1,2, , 1h k h M k for k M A. Symmetrical impulse response:

B. Antisymmetrical impulse response:

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

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.

35

 3.2.1. Symmetrical Impulse Response, M: Even

( )h n

n

16M

h(0)=h(15)

h(1)=h(14)

h(2)=h(13)

h(7)=h(8)

36

0,1,2, , 1k M

(0) ( 1), (1) ( 2), (2) ( 3), ,

12 2

h h M h h M h h M

M Mh h

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

1 4 1 3 0,1,2,3

(0) (3) (1) (2)

4 41 1 1 2

2 2 2 2

M k

h h h h

M M

37

End.

1 4 1 3

0 0 0

( ) ( ) ( ) ( )M

j j k j k j k

k k k

H e h k e h k e h k e

0 1 2 3( ) (0) (1) (2) (3)j j j j jH e h e h e h e h e

0 3 1 2(0) (1)j j j jh e e h e e

1

4 1

0

( ) j kj k

k

h k e e

1

21

0

( )

M

j M kj k

k

h k e e

4.for M

38

1

1 21

0 0

( ) ( ) ( )

MM

j M kj j k j k

k k

H e h k e h k e e

11 22

0

1( ) 2 ( )cos

2

MM

jj

k

MH e e h k k

Here, the real-valued frequency response is given by

12

0

1( ) 2 ( )cos

2

M

rk

MH h k k

1 111 2 22

2

0

2 ( )2

M MM j k j kM

j

k

e ee h k

39

1

2

1

2

1

2

( ) ( )

( ) ( ) 0

( ) ( ) 0

( ) ( )

1( ) 0

2( )1

( ) 02

Mjj

r

Mj

r r

Mj

r r

jr

r

r

H e e H

H e for H

H e for H

H e H

Mfor H

Mfor H

( ) 1( )

2

d M

d

40

We observe that the phase response is a linear function of provided that is positive or negative. When changes the sign from positive to negative (or vice versa), the phase undergoes an abrupt change of 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 stop-band.

( )rH ( )rH

41

3.2.2. Symmetrical Impulse Response, M: Odd( )h n

n

15M

h(0)=h(14)

“h(7)=h(7)”

h(1)=h(13)

h(6)=h(8)

42

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

1 4 0,1,2,3,4

(0) (4) (1) (3) (2) (2)

5 3 3 11 2

2 2 2

M k

h h h h h h

M M

0,1,2, , 1k M

(0) ( 1), (1) ( 2), (2) ( 3), ,

3 1 1 1,

2 2 2 2

h h M h h M h h M

M M M Mh h h h

43

1 131 2 22

2

0

12 ( )

2 2

M MM j k j kM

j

k

M e ee h h k

31 2

2

0

1 12 ( )cos

2 2

MM

j

k

M Me h h k k

1

0

31 2

12

0

( ) ( )

1( )

2

Mj j k

k

MM

j j M kj k

k

H e h k e

Mh e h k e e

the real-valued frequency response ( )rH

44

1

2

1

2

1

2

( ) ( )

( ) ( ) 0

( ) ( ) 0

( ) ( )

1( ) 0

2( )1

( ) 02

Mjj

r

Mj

r r

Mj

r r

jr

r

r

H e e H

H e for H

H e for H

H e H

Mfor H

Mfor H

( ) 1( )

2

d M

d

45

3.2.3. Antisymmetrical Impulse Response, M: Even

16M ( )h n

n

h(0)=-h(15)

h(7)=-h(8)

h(1)=-h(14)

46

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

1 3 0,1,2,3

(0) (3) (1) (2)

41 1 1

2 2

M k

h h h h

M

0,1,2, , 1k M

(0) ( 1), (1) ( 2), (2) ( 3), ,

12 2

h h M h h M h h M

M Mh h

47

1

1 21

0 0

( ) ( ) ( )

MM

j M kj j k j k

k k

H e h k e h k e e

1 111 2 22

2

0

2 ( )2

M MM j k j kM

j

k

e eje h k

j

11 22 2

0

12 ( )sin

2

MM

j j

k

Me h k k

the real-valued frequency response ( )rH

48

1

2 2

1

2 2

1 3

2 2

( ) ( )

( ) ( ) 0

( ) ( ) 0

( ) ( )

1( ) 0

2 2( )1 3

( ) 02 2

Mj jj

r

Mj j

r r

Mj j

r r

jr

r

r

H e e H

H e for H

H e for H

H e H

Mfor H

Mfor H

( ) 1( )

2

d M

d

49

Here, the real-valued frequency response is given by

12

0

1( ) 2 ( )sin

2

M

rk

MH h k k

12

0

1(0) 2 ( )sin 0 0

2

M

rk

MH h k k

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

50

3.2.4. Antisymmetrical Impulse Response, M: Odd

n

( )h n 17M

h(0)=-h(16)

h(1)=-h(15)

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

h(7)=-h(9)

!

51

Example: M=5 (odd), antisymmetrical impulse response 1 4, 0,1,2,3,4

(0) (4), (1) (3),

5 3 3 5

(2) (2) (2) 0 !

1 11 2

2 2 2 2

h

M k

h h h h

M

h

M

h

0,1,2, , 1k M (0) ( 1), (1) ( 2), (2) ( 3), ,

3 1,

2 2

1 10

2 2

h h M h h M h h M

M Mh

M Mh h

h

52

31 2

1

0 0

( ) ( ) ( )

MM

j M kj j k j k

k k

H e h k e h k e e

31 2

2 2

0

12 ( )sin

2

MM

j

k

Me h k k

1 131 2 22

2

0

2 ( )2

M MM j k j kM

j

k

e eje h k

j

the real-valued frequency response ( )rH

53

1

2 2

1

2 2

1 3

2 2

( ) ( )

( ) ( ) 0

( ) ( ) 0

( ) ( )

1( ) 0

2 2( )1 3

( ) 02 2

Mj jj

r

Mj j

r r

Mj j

r r

jr

r

r

H e e H

H e for H

H e for H

H e H

Mfor H

Mfor H

( ) 1( )

2

d M

d

54

Here, the real-valued frequency response is given by

3

2

0

1( ) 2 ( )sin

2

M

rk

MH h k k

12

0

1(0) 2 ( )sin 0 0

2

M

rk

MH h k k

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

55

4. Linear-Phase FIR Digital Filter Design

4.1. Window (Windowing) Method

56

4.1.1. Basic Principles and Algorithms

Since , 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

( )jH e

( ) ( )j j k

k

H e h k e

1

( ) ( )2

j j nh n H e e d

The coefficients 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:

( )h k

57

1. The filter impulse response is infinite in duration, since the above given summation extends to .

Hence the filter resulting from a Fourier series representation of is an unrealizable (non-causal) IIR filter. In spite of that fact, the causal FIR filter can be designed by the approach illustrated in the next figures.

( )jH e

2. The filter is unrealizable (non-causal) because the impulse response begins at ; i.e. no finite amount of delay can make the impulse response realizable.

( ) ( )j j k

k

H e h k e

( ) ( )j j k

k

H e h k e

58

( ) ( )j j k

k

H e h k e

4.1.1. Summary

( ) ( ) ( )k

y n h k x n k

1

( ) ( )2

j j nh n H e e d

Non-Causal IIR filter:

Causal filter : ( ) 0 0h k for k

: ( ) 0M N h n for n M FIR filter :

1

0

( ) ( )M

j j k

k

H e h k e

1

0

( ) ( ) ( )M

k

y n h k x n k

Causal FIR filter of length M:

59

( )h n

n

n

n

n

( )g n

( )f n

( )w n Rectangular window

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

3N

( ) ( 3)g n f n

( , )n

red

red

Window (Windowing) Method: Time-Domain

7M 1

( ) ( )2

j j nh n H e e d

( ) ;

( ) 0

w n R for N n N

w n for n N

60

jH e jH e

jW e

Windows (Windowing) Method: Frequency-Domain

Ripple! jF e

Side lobes

Central (main) lobe

No ripple! jH e

[ ( )]jH e FT h n

[ ( )]jW e FT w n

*j j jF e H e W e

Gibbs Phenomenon

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

61

Example:

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) . Frequency sampling is .

0 1f kHz4Sf kHz

Solution:

4Sf kHz 0 1f kHz 30 3

2 2.1.10

4.10 2os

ff

0

0

12( )

02

j

forH e

for

Low-pass filter:

62

2 21

2

jn jne e

n j

/ 2

/ 2

11

2j ne d

1

( ) ( )2

j j nh n H e e d

/ 2

/ 2

1

2

j ne

jn

2 21

2 2

jn jne e

n j j

sin2

n

n

63

10.5

2 2 2

01(0) ( )

2j jh H e e d

/ 2

/ 2

11

2d

/ 2

/ 2

1

2

sin02( ) 00

nh n for n

n

?

Solution (1):

Problem:

64

0(0) lim ( )

nh h n

Rectangular window application:

( ) ( )f n h n for 7,7n

Solution (2):

0

sin2lim

n

n

n

0

sin12lim2

2

n

n

n

10.5

2

0

sin1 2lim2

2

n

n

n

65

n

n

( ) ( )h n f n

( )g n 0,14n

7,7n Example: Impulse Responses

g(0)=f(-7)

g(1)=f(-6) g(14)=f(7)

66

Example: Magnitude Response

Example: Phase Response

jG e

( )

0 2

0 2

67

4.1.2. Gibbs Phenomenon and Different Windowing

Direct truncation of impulse response leads to well known Gibbs phenomenon. It manifests itself as a fixed percentage overshoot and ripple before and after discontinuity in the frequency response. E.g. standard filters, the largest ripple in the frequency response is about 9% 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 series does not decrease the amplitude of the largest ripple. Instead, the overshoot is confined to a smaller and smaller frequency range as is increased.

68

Example: Gibbs phenomenon illustration

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

/ 2

69

Low-Pass FIR Filter: Rectangular Window Application

jG e

jG e jG e

jG e

5N

100N 50N

25N

/ 2

/ 2

/ 2

/ 2

70

Comments:

The major effect is that discontinuities of became 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 window’s frequency response

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

( )jH e

( ) ( ) * ( )j j jF e H e W e

( )jW e

71

The second effect of the windowing is that the ripple from the side lobes produces a ripple in the resulting frequency response. Finally, since the filter frequency response is obtained via convolution relation, it is clear that the resulting filters are never optimal in any sense, even though the windows from which they are obtained may satisfy some reasonable optimality criterion:

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 .

72

4.1.2.1. Some Commonly Used Windows

1

2

MN

Blackmann: 2 4

( ) 0.42 0.5cos 0.08cos2 1 2 1

n nw n

N N

Hamming:2

( ) 0.54 0.46cos2 1

nw n

N

Hann: 1 2

( ) 1 cos2 2 1

nw n

N

Bartlett: ( ) 11

nw n

N

Rectangular: ( ) 1w n

( )w n R for N n N ( ) 0w n for n N

73

Kaiser (adjustable window): parameter

2

0

0

1

( )( )

nI

Nw n

I

0 ( )I x : the modified zero-th-order Bessel function of the first kind, which has the simple power series expansion.

2

01

/ 2( ) 1

!

r

r

xI x

r

For most practical applications, about 20 terms in the above summation are sufficient to arrive at reasonably accurate

74

Window Function: A Review (M=55, N=27)( )w n

( )w n( )w n

( )w n

n

nn

n

Bartlett Hann

Hamming Blackman

75

Kaiser Window =1 =3

=8

=15=30

( )w n

n

76

Example:

By the windowing method, design a low-pass filter of order N=55 with pass-band cut off frequency . Frequency sampling is .

Solution: MATLAB function fir1.m. For the results see the next figures.

0 1f kHz4Sf kHz

77

Example:FIR Filter Design by Windowing Method

1020*log jH e

N=55

Rectangular Window

Bartlett Window

Hamming Window

[dB]

78

Example:FIR Filter Design by Windowing Method

1020*log jH e

Rectangular Window

Kaiser Window: alfa=3

Kaiser Window: alfa=10

Kaiser Window: alfa=15

Kaiser Window: alfa=30

[dB]