Anda di halaman 1dari 70

DIGITAL FILTERS

Vedat Tavanolu

Frequency Response of Ideal Filters


Low-pass Filters

H ILP ( e j )
1 -4 -3 -2 - c 0 c 2 3 4

H ILP ( e

1 for c c )= 0 for c

and c

H ILP ( e j ) = H ILP ( e j ( 2 k ) ) ; k = 1,2,........


DIGITAL FILTERS Vedat Tavanolu 2

Frequency Response of Ideal Filters


High-pass Filters 1 -4 -3 -2 - c 0 c 2 3 4

H ILP ( e j )

H IHP ( e j )
1 -4 -3 -2 - l 0 l 2 3 4

H IHP ( e j ) = H ILP ( e j ( ) ) ;
DIGITAL FILTERS Vedat Tavanolu

c = l
3

Frequency Response of Ideal Filters


Band-pass Filters 1 -4 -3 -2 - c 0 c 2 3 4

H ILP ( e j )

H IBP ( e j )
1 -4 -3 -2 - 0 0 0 2 3 4

H IBP ( e j ) = H ILP ( e j ( 0 ) ) + H ILP ( e j( +0 ) )


DIGITAL FILTERS Vedat Tavanolu 4

Frequency Response of Ideal Filters


Band-stop Filters -4 -3 -2 - 0

H IBP ( e j )
0 0 2 3 4

H IBP ( e j )
-4 -3 -2 - 0 0 0 2 3 4

H IBS ( e j )
-4 -3 -2 - 0 0 0 2 3 4

H IBS ( e

) = 1 H IBP ( e
DIGITAL FILTERS Vedat Tavanolu

)
5

Frequency Response of Ideal Filters


All-pass Filters

| H IAP ( e j ) |
-4 -3 -2 - 0 0 0 2 3 4

DIGITAL FILTERS Vedat Tavanolu

Impulse Response of Ideal Low-pass Filters


H ILP ( e
j

1 for c c )= 0 for c

and c

H ILP ( e j ) = H ILP ( e j ( 2 k ) ) ; k = 1,2,........

hILP ( n ) = F { H ILP ( e
DIGITAL FILTERS Vedat Tavanolu

)}
7

Impulse Response of Ideal Low-pass Filters


1 hILP ( n ) = 2

H ILP ( e

)e

jn

1 d = 2

jn e d

1 sin c n j c n j c n e hILP ( n ) = (e )= 2jn n

DIGITAL FILTERS Vedat Tavanolu

Impulse Response of Ideal Low-pass Filters


close all n=-20:1:20; wc=pi/2; x=sin(wc*(n+.0001)); h=x./(pi*(n+.0001)); stem(n,h) title('h(n)=sin(wc*n)/(pi*n); wc=pi/2') xlabel('n')

DIGITAL FILTERS Vedat Tavanolu

Impulse Response of Ideal Low-pass Filters

DIGITAL FILTERS Vedat Tavanolu

10

Impulse Response of Ideal Low-pass Filters

DIGITAL FILTERS Vedat Tavanolu

11

Impulse Response of Ideal Low-pass Filters


Amplitude values of

sin c n hILP ( n ) = n
3
-0.11 0.08 0.11

for c=/2, /4, and /6

c
2

0
0.5 0.25

1
0.32 0.23 0.16

2
0 0.16 0.14

4
0 0 0.07

5
0.06 -0.05 0.03

6
0 -0.05 0

7
-0.05 -0.03 -0.02

8
0 0 -0.03

9
0.04 0.03 -0.04

10
0 0.03 -0.03

4
1/6

DIGITAL FILTERS Vedat Tavanolu

12

Design of Low-pass Filters

h( n ) = { h( 0 ), h( 1 ),........, h( N 1 ), h( N )}
1 0 x(n) h(N) h(N-1) h(N-2) . . . . h(1) h(0)

Let x(n)=(n),i.e., a unit sample, then the output of the system Shown below is given as:

h(0) 0

h(1) 1

.................

h(N) N

Ts

Ts
DIGITAL FILTERS Vedat Tavanolu

Ts
13

y(n)

Design of Low-pass Filters


The two features of such a system are: The response to the unit-sample is of finite duration. The response to the unit-sample starts at time zero,i.e., at n=0.

DIGITAL FILTERS Vedat Tavanolu

14

Design of Low-pass Filters


However, the impulse response of the ideal low-pass filter,

sin c n hILP ( n ) = n
is of infinite duration and extends symmetrically to infinity on both sides of n=0.
DIGITAL FILTERS Vedat Tavanolu 15

Design of Low-pass Filters


This implies that the impulse response of the ideal low-pass filter is not realisable with such a system. The question is: How can we make such an impulse response realisable?
DIGITAL FILTERS Vedat Tavanolu 16

Design of Low-pass Filters


Obviously by making it: to have finite duration. to start at time zero. This can be acomplished by: first truncating it on both ends to make it finite duration. secondly shifting to the right to make it start at time zero .

DIGITAL FILTERS Vedat Tavanolu

17

Design of Low-pass Filters


The Fourier transform of

sin c n hILP ( n ) = n
is given as:

H ILP ( e

)=

n =

ILP

( n )e

jn

DIGITAL FILTERS Vedat Tavanolu

18

Design of Low-pass Filters


This can also be interpreted as the Fourier series expansion of HILP(ej), which is the periodic square waveform with duty cycle 2c. Since HILP(ej) is symmetrical around n=0, we can write: j ILP ILP ILP n =0

(e

) = h ( 0 ) + 2 h ( n ) cos n

Now consider the truncation of hILP(n) at both ends.


DIGITAL FILTERS Vedat Tavanolu 19

Design of Low-pass Filters


Truncated impulse response is given by:

h t ( n ) = hILP ( n )[ u( n + N ) u( n N )]
The Fourier transform of ht(n) is obtained as:

Ht ( e

) = hILP ( 0 ) + 2 hILP ( n ) cos n


n =1
DIGITAL FILTERS Vedat Tavanolu 20

Design of Low-pass Filters


We have

Ht ( e
Assuming

c 2 N sin c n + )= cos n n=1 n

c = 2

Ht ( e

1 1 2 1 ) = + (cos cos 3 + .... + cos N ) 2 3 N


DIGITAL FILTERS Vedat Tavanolu 21

Design of Low-pass Filters


In the following we will deal with the Frequency Response of Truncated Impulse Response or equivalently we can say Truncated Fourier Series Expansion of Ideal Filter Frequency Response.
DIGITAL FILTERS Vedat Tavanolu 22

Design of Low-pass Filters


MATLAB Program to Compute the Frequency Response of Truncated Impulse Response from n = 6 close all title('Truncated Fourier Series w=-2*pi:pi/64:2*pi; Expansion of Ideal Filter wc=pi/2; Frequency Response'); h=wc/pi; xlabel('w'); n=1; ylabel('|HILP(expjw)|') while n<6 x=sin(wc*(n+.0001)); x1=x./(pi*(n+.0001)); x2=2*x1*cos(w*n); h=h+x2; n=n+1; end figure,plot(w,h);
DIGITAL FILTERS Vedat Tavanolu 23

Design of Low-pass Filters


Frequency Response of Truncated Impulse Response from n = 6 plotted for 2<<2

DIGITAL FILTERS Vedat Tavanolu

24

Design of Low-pass Filters


Frequency Response of Truncated Impulse Response from n = 16 plotted for 2<<2

DIGITAL FILTERS Vedat Tavanolu

25

Design of Low-pass Filters


Frequency Response of Truncated Impulse Response from n = 32 plotted for 2<<2

DIGITAL FILTERS Vedat Tavanolu

26

Design of Low-pass Filters


Frequency Response of Truncated Impulse Response from plotted for <<

n = 32

DIGITAL FILTERS Vedat Tavanolu

27

Design of Low-pass Filters


What remains to be done to obtain a realisable frequency response is to shift ht(n) to the right by N, i.e., the realisable impulse response is given as:

Since:

h( n ) = ht ( n N )
F { ht ( n N )} = e
jN

Ht( e
j

we obtain

F { h( n )} = e

jN

Ht ( e

)
28

DIGITAL FILTERS Vedat Tavanolu

Design of Low-pass Filters


H( e
j

) = ( hILP ( 0 ) + 2 hILP ( n ) cos n )e


n =0
j

jN

H( e

c 2 N sin c n jN + )=( cos n )e n =1 n

Given c , the design of the truncated low-pass filter is straightforward.


DIGITAL FILTERS Vedat Tavanolu 29

Design of HP, BP and BS Filters


The low-pass design is also used in the design of HP,BP and BS filters. For such filters the frequency specifications are first translated to the frequency specifications of the corresponding lowpass filter.Then the impulse response of the required filter is obtained through relationships given above:
DIGITAL FILTERS Vedat Tavanolu 30

Design of HP, BP and BS Filters


High-pass Filters
The relation between the frequency responses of highand low-pass filters was given as:

H HP ( e
We know that:

) = H LP ( e

j ( )

)
jn

H LP ( e

)=

n =

LP

( n )e

Using the above relationship we can write


DIGITAL FILTERS Vedat Tavanolu 31

Design of HP, BP and BS Filters

H HP ( e =

) = H LP ( e ( n )e
jn

j ( )

)=

n = jn

LP

( n )e

j ( ) n

n =

LP

n =

( 1 ) h
n n

LP

( n )e

jn

where we used the identity

jn

= ( 1 )

DIGITAL FILTERS Vedat Tavanolu

32

Design of HP, BP and BS Filters


We can conclude that:

hHP ( n ) = ( 1 ) hLP ( n )
n

DIGITAL FILTERS Vedat Tavanolu

33

Design of HP, BP and BS Filters

DIGITAL FILTERS Vedat Tavanolu

34

Design of HP, BP and BS Filters

DIGITAL FILTERS Vedat Tavanolu

35

Design of HP, BP and BS Filters

DIGITAL FILTERS Vedat Tavanolu

36

Design of HP, BP and BS Filters


Amplitude values of

sin c n hIHP ( n ) = ( 1 ) for c = / 2 , / 4, / 6 n


n

c
2

0
0.5 0.25

1
-0.32 -0.23 -0.16

2
0 0.16 0.14

3
-0.11 -0.08 -0.11

4
0 0 0.07

5
-0.06 0.05 -0.03

6
0 -0.05 0

7
0.05 0.03 0.02

8
0 0 -0.03

9
-0.04 -0.03 0.04

10
0 0.03 -0.03

4
1/6

DIGITAL FILTERS Vedat Tavanolu

37

Design of HP, BP and BS Filters


close all w=-2*pi:pi/64:2*pi; wc=pi/2; h=wc/pi; n=1; while n<6 x=((-1).^n)*sin(wc*(n+.0001)); x1=x./(pi*(n+.0001)); x2=2*x1*cos(w*n); h=h+x2; n=n+1; end figure,plot(w,h); title('Truncated Fourier Series Expansion of Ideal HP Filter Frequency Response; wc=pi/2'); xlabel('w'); ylabel('|HIHP(expjw)|')
DIGITAL FILTERS Vedat Tavanolu 38

Design of HP, BP and BS Filters


Frequency Response of Truncated Impulse Response from n = 6 plotted for 2<<2

DIGITAL FILTERS Vedat Tavanolu

39

Design of HP, BP and BS Filters


Frequency Response of Truncated Impulse Response from plotted for 2<<2

n = 16

DIGITAL FILTERS Vedat Tavanolu

40

Design of HP, BP and BS Filters


Frequency Response of Truncated Impulse Response from plotted for 2<<2

n = 32

DIGITAL FILTERS Vedat Tavanolu

41

Design of HP, BP and BS Filters


Frequency Response of Truncated Impulse Response from plotted for <<

n = 32

DIGITAL FILTERS Vedat Tavanolu

42

Design of HP, BP and BS Filters


Q.1 An analogue high-pass filter approximating the frequency characteristic given in the figure below is to be designed using the system given on the next page which is composed of an A/D converter, a 5-coefficient causal Finite Impulse Response (FIR) digital filter and a D/A converter, where A/D and D/A converters are assumed to be perfect.
The lower cutoff frequency of the analogue high-pass filter and the maximum frequency in the analogue input signal are given as: Fl=60 kHz and Fmax=80kHz.

DIGITAL FILTERS Vedat Tavanolu

43

Design of HP, BP and BS Filters


(a)Find and plot the impulse response hILP(n) of the corresponding ideal low-pass filter. (b)Find and plot the impulse response hLP(n) of the 5-coefficient causal filter. (c)Give the expression for HLP(ej) and |HLP(ej)| and sketch |HLP(ej)| roughly. (d)Give hhP(n) and HHP(ej). Plot |HLP(ej)| roughly.

DIGITAL FILTERS Vedat Tavanolu

44

Design of HP, BP and BS Filters


H HP ( j )
1

DIGITAL FILTERS Vedat Tavanolu

45

Design of HP, BP and BS Filters

Analogue Filter

xa (t )

A/D

x (n)

Digital Filter

y (n)

D/A

y a (t )

Fs

Fs

DIGITAL FILTERS Vedat Tavanolu

46

Design of HP, BP and BS Filters


Solution: (a)Minimum sampling frequency is found as:

Fs = 2 Fmax = 80kHz
Using this frequency we find:

Fl 20 1 = = fl = Fs 80 4
DIGITAL FILTERS Vedat Tavanolu

l = 2
47

Design of HP, BP and BS Filters


H ILP ( e
1 -3 -2 - l 0 l 2 3 4
j

The cutoff frequency of the corresponding prototype lowpass filter can be found as:

The impulse response of the prototype lowpass filter:

c = l = 2

DIGITAL FILTERS Vedat Tavanolu

48

Design of HP, BP and BS Filters

sin c n sin 2 n = hILP ( n ) = n n

DIGITAL FILTERS Vedat Tavanolu

49

Design of HP, BP and BS Filters


(b)The impulse response of the 5-coefficient (truncated) causal filter is given as:

sin ( n 2 ) 2 hLP ( n ) = [ u( n ) u( n 2 )] ( n 2 )

DIGITAL FILTERS Vedat Tavanolu

50

Design of HP, BP and BS Filters

DIGITAL FILTERS Vedat Tavanolu

51

Design of HP, BP and BS Filters


(c)

H LP ( e

) = [ hLP ( 0 ) + 2hLP ( 1 ) cos ] e

j 2

= [ 0.5 + 0.64 cos ] e | H LP ( e


j

j 2

) |=| 0.5 + 0.64 cos |


DIGITAL FILTERS Vedat Tavanolu 52

Design of HP, BP and BS Filters

DIGITAL FILTERS Vedat Tavanolu

53

Design of HP, BP and BS Filters


(d)
hHP ( n ) = ( 1 )( n 2 ) sin ( n 2 ) 2 [ u( n ) u( n 2 )] ( n 2 )
j 2

H HP ( e

) = [ hLP ( 0 ) 2hLP ( 1 ) cos ] e

= [ 0.5 0.64 cos ] e

j 2

| H HP ( e

) |=| 0.5 0.64 cos |


DIGITAL FILTERS Vedat Tavanolu 54

Design of HP, BP and BS Filters

DIGITAL FILTERS Vedat Tavanolu

55

Design of HP, BP and BS Filters


Band-pass Filters
The relation between the frequency responses of ideal bandand low-pass filters was given as:

H IBP ( e

) = H ILP ( e

j ( 0 )

) + H ILP ( e

j ( + 0 )

Using the above relationship we can write

H IBP ( e j ) =

n =

j ( 0 ) n h ( n ) e + ILP

n =

j ( + 0 ) n h ( n ) e ILP

DIGITAL FILTERS Vedat Tavanolu

56

Design of HP, BP and BS Filters


H IBP ( e
j

)= = = =

n =

ILP

( n )e

j ( 0 ) n

n =

ILP

( n )e

j ( + 0 ) n

n =

jn j0 n + h ( n ) e e ILP

n =

jn j0 h ( n ) e e ILP

n =

j 0 n j 0 jn + h ( n ) e ( e e ) ILP

n =

( 2h

ILP

( n ) cos 0 n ) e

jn

where we used the identity

DIGITAL FILTERS Vedat Tavanolu

57

Design of HP, BP and BS Filters


We can make the following identification:

hIBP = 2hILP ( n ) cos 0 n

DIGITAL FILTERS Vedat Tavanolu

58

Design of HP, BP and BS Filters


MATLAB Program Computing the Impulse Response of BP Filter with w0=pi/3

close all n=-20:1:20 wc=pi/4 w0=pi/3 x=sin(wc*(n+.0001)); h=x./(pi*(n+.0001)); h=2*h.*cos(w0*n) stem(n,h) title('hIBP(n)=2*cos(w0*n)*sin(wc*n)/(pi*n); wc=pi/4, w0=pi/3') xlabel('n')
DIGITAL FILTERS Vedat Tavanolu 59

Design of HP, BP and BS Filters


Impulse Responses of BP Filters with w0=pi/3

DIGITAL FILTERS Vedat Tavanolu

60

Design of HP, BP and BS Filters


close all w=-2*pi:pi/64:2*pi; wc=pi/6; w0=2*pi/3; h=2*wc/pi; n=1; while n<33 x=sin(wc*(n+.0001)); x1=x./(pi*(n+.0001)); x1=2*x1.*cos(w0*n) x2=2*x1.*cos(w*n); h=h+x2; n=n+1; end figure,plot(w,h); title('Truncated Fourier Series Expansion of Ideal BP Filter Frequency Response; wc=pi/6,w0=2pi/3'); xlabel('w'); ylabel('|HIBP(expjw)|')

DIGITAL FILTERS Vedat Tavanolu

61

Design of HP, BP and BS Filters


Frequency Response of Truncated Impulse Response from n = 6 plotted for 2<<2

DIGITAL FILTERS Vedat Tavanolu

62

Design of HP, BP and BS Filters


Frequency Response of Truncated Impulse Response from n = 16 plotted for 2<<2

DIGITAL FILTERS Vedat Tavanolu

63

Design of HP, BP and BS Filters


Frequency Response of Truncated Impulse Response from plotted for 2<<2

n = 32

DIGITAL FILTERS Vedat Tavanolu

64

Design of HP, BP and BS Filters


Frequency Response of Truncated Impulse Response from plotted for <<

n = 32

DIGITAL FILTERS Vedat Tavanolu

65

Design of HP, BP and BS Filters


Band-stop (reject) Filters
The relation between the frequency responses of ideal band-pass and band-stop filters was given as:

H IBS ( e

) = 1 H IBP ( e

Taking the inverse Fourier transform of both sides,we obtain,

hIBS ( n ) = ( n ) hIBP ( n )

hIBS = ( n ) 2hILP ( n ) cos 0 n


DIGITAL FILTERS Vedat Tavanolu 66

Design of HP, BP and BS Filters


Frequency Response of Truncated Impulse Response from plotted for 2<<2

n = 6

DIGITAL FILTERS Vedat Tavanolu

67

Design of HP, BP and BS Filters


Frequency Response of Truncated Impulse Response from n = 16 plotted for 2<<2

DIGITAL FILTERS Vedat Tavanolu

68

Design of HP, BP and BS Filters


Frequency Response of Truncated Impulse Response from n = 33 plotted for 2<<2

DIGITAL FILTERS Vedat Tavanolu

69

Design of HP, BP and BS Filters


Frequency Response of Truncated Impulse Response from plotted for <<

n = 32

DIGITAL FILTERS Vedat Tavanolu

70

Anda mungkin juga menyukai