You are on page 1of 21

TECHNOLOGICAL INSTITUTE OF THE PHILIPPINES

938 AURORA BOULEVARD, CUBAO, QUEZON CITY

Advanced Digital Signal Processing

Chapter 7: Finite Impulse Response Filter Design

Rating:

Aloysius Jan P. Quiros


EC42FB1

Engr. Francis Malit


Instructor

February 22, 2016

TECHNOLOGICAL INSTITUTE OF THE PHILIPPINES


938 AURORA BOULEVARD, CUBAO, QUEZON CITY

Advanced Digital Signal Processing

Chapter 7: Finite Impulse Response Filter Design

Rating:

Lacuna, Karen D.
EC42FB1

Engr. Francis Malit


Instructor

7.1. Design a 3-tap FIR lowpass filter with a cutoff frequency of 1,500 Hz and a sampling rate of 8,000
Hz using
a. rectangular window function
b. Hamming window function.
Determine the transfer function and difference equation of the designed FIR system, and compute

and plot the magnitude frequency response for = , , ,

Solution:
1
3
= 2 = 2(1500) (
)=
8000
8
2 + 1 = 3
=1

() = {sin(

=0
11

3
3
(0) = 8 =

8
(1) = (1) =

3
sin [8 (1)]
(1)

= 0.2940799888

a. rectangular window function


() = 1,
(0) = (1) = (1) = 1

Windowed impulse response

3
3
(0) = (0) (0) = (1) = = 0.375
8
8
(1) = (1) = (1) (1) = 0.2940799888(1) = 0.2940799888
0 = 2 = 0.2940799888
b1 = 0.375

Transfer function
() = . + . + .

Difference equation

() =

()
= 0.2940799888 + 0.375 1 + 0.2940799888z 2
()

() = 0.2940799888X(z) + 0.375 1 () + 0.2940799888z 2 ()


() = . () + . ( ) + . ( )

Magnitude frequency response

( ) = 0.2940799888 + 0.375 + 0.2940799888e2j


( ) = (0.2940799888ej + 0.375 + 0.2940799888ej )
( ) = [0.375 + 0.5881599776 cos()]
|( )| = |[. + . ()]|
0.375+0.5881599776 cos() >0
H(ej )={
+ 0.375+0.5881599776 cos()<0

2
0

0.375
+ 0.5881599776 cos()
0.9631599776

|( )|

|( )|

H(ej )

0.9631599776

-0.3260314409

2
3
4

1000

0.7908919086

0.7908919086

-2.037657352

45

2000

.375

.375

-8.519374645

90

3000

-0.04089190858

0.04089190858

-27.76725238

45

4000

-0.2131599776

0.2131599776

-13.42588668

Plot
[hz, w] = freqz( [0.2941 0.375 0.2941], [1], 512);
phi= 180*unwrap(angle(hz))/pi;
plot(w,20*log10(abs(hz))),grid;
xlabel(Frequency (radians));
ylabel(Magnitude Response (dB))

b. hamming window function

() = 0.54 + 0.46 cos ( ) ,

(0)()
(0) = 0.54 + 0.46 cos [
]=1
1
(1)()
(1) = (1) = 0.54 + 0.46 cos [
] = 0.08
1

Windowed impulse response


3
3
(0) = (0) (0) = (1) = = 0.375
8
8
(1) = (1) = (1) (1) = 0.2940799888(0.08) = 0.0235263991
0 = 2 = 0.0235263991
b1 = 0.375

Transfer function
() = . + . + .

Difference equation

() =

()
= 0.0235263991 + 0.375 1 + 0.0235263991z 2
()

() = 0.0235263991X(z) + 0.375 1 () + 0.0235263991z 2 ()


() = . () + . ( ) + . ( )

Magnitude frequency response


( ) = 0.0235263991 + 0.375 + 0.0235263991e2j
( ) = (0.0235263991ej + 0.375 + 0.0235263991ej )
( ) = [0.375 + 0.0470527982 cos()]
|( )| = |[. + . ()]|
0.375+0.0470527982 cos() >0
H(ej )={
+ 0.375+0.0470527982 cos()<0

0

2
0
1000

0.375
+ 0.0470527982 cos()
0.4220527982
0.4082713527

|( )|

|( )|

0.4220527982
0.4082713527

-7.49266432
-7.781021846

H(ej )
degree
0
45


2
3
4

2000

0.375

0.375

-8.519374645

90

3000

0.3417286473

0.3417286473

-9.326372251

135

4000

0.3279472018

0.3279472018

-9.683921407

180

Plot
[hz, w] = freqz( [0.0235 0.375 0.0235], [1], 512);
phi= 180*unwrap(angle(hz))/pi;
plot(w,20*log10(abs(hz))),grid;
xlabel(Frequency (radians));
ylabel(Magnitude Response (dB))

7.3. Design a 5-tap FIR bandpass filter with a lower cutoff frequency of 1,600 Hz, an upper cutoff
frequency of 1,800 Hz, and a sampling rate of 8,000 Hz using
a. rectangular window function
b. Hamming window function.
Determine the transfer function and difference equation of the designed FIR system, and compute

and plot the magnitude frequency response for = , , ,

Solution:
= 2 = 2(1600) (

1
2
)=
8000
5

= 2 = 2(1800) (

1
9
)=

8000
20

2 + 1 = 5
=2

() = {sin(

sin( )

=0

9
2

20
5 = 1
(0) =

20
(1) = (1) =

(2) = (2) =

9
sin [20 (1)]
(1)

9
sin [20 (2)]
(2)

2
sin [ (1)]
5

= 0.01166027182
(1)

2
sin [ (2)]
5

= 0.04436734622
(2)

a. rectangular window function


() = 1,
(0) = (1) = (1) = (2) = (2) = 1

Windowed impulse response


(0) = (0) (0) =

1
1
(1) =
= 0.05
20
20

(1) = (1) = (1) (1) = 0.01166027182(1) = 0.01166027182


(2) = (2) = (2) (2) = 0.04436734622(1) = 0.04436734622
0 = 4 = 0.04436734622
1 = 3 = 0.01166027182
b2 = 0.05

Transfer function
() = . + . + . + . .

Difference equation

() =

()
= 0.04436734622 + 0.01166027182 1 + 0.05z 2 + 0.01166027182 3 0.04436734622 4
()

() = 0.04436734622X(z) + 0.01166027182 1 () + 0.05z 2 () + 0.01166027182 3 ()


0.04436734622 4 ()
() = . () + . ( ) + . ( ) + . ( )
. ( )

Magnitude frequency response


( ) = 0.04436734622 + 0.01166027182 + 0.05e2j + 0.01166027182 3
0.04436734622 4
( ) = (0.04436734622ej + 0.01166027182 + 0.05ej + 0.01166027182 2
0.04436734622 3 )

( ) = {0.04436734622[cos + sin ] + 0.01166027182 + 0.05[cos() + sin() ]


+ 0.01166027182[cos(2) + sin(2) ]
0.04436734622[cos(3) + sin(3) ]}
( ) = {. [ + ] + .
+ . [() () ] + . [() () ]
. [() () ]}
|( )| = |{0.04[cos + sin ] + 0.01 + 0.05[cos() sin() ] + 0.01[cos(2) sin(2) ]
0.04[cos(3) sin(3) ]}|
{0.04[cos + sin ]+0.01+0.05[cos() sin() ]+0.01[cos(2) sin(2) ]0.04[cos(3) sin(3) ]}>0
H(ej )={
+ {0.04[cos + sin ]+0.01+0.05[cos() sin() ]+0.01[cos(2) sin(2) ]0.04[cos(3) sin(3) ]}<0

2
3
4

|( )|

|( )|

H(ej )

0
1000

{0.04[cos + sin ] + 0.01


+ 0.05[cos() sin() ]
+ 0.01[cos(2) sin(2) ]
0.04[cos(3) sin(3) ]}
-0.01
0.05-0.05i=0.07-0.79

0.01
0.07

-40
-23.10

180
135

2000

-0.13i=0.13-1.57

0.13

-17.72

90

3000

-0.03-0.03i= 0.04-2.36

0.04

-27.96

45

4000

0.05

0.05

-26.02

180

Plot
() = 0.04436734622 + 0.01166027182 1 + 0.05z 2 + 0.01166027182 3 0.04436734622 4

[hz, w] = freqz( [-0.0444 0.0117 0.05 0.0117 -0.0444], [1], 512);


phi= 180*unwrap(angle(hz))/pi;
plot(w,20*log10(abs(hz))),grid;
xlabel(Frequency (radians));
ylabel(Magnitude Response (dB))

b. Hamming window function.

() = 0.54 + 0.46 cos ( ) ,

(0)()
(0) = 0.54 + 0.46 cos [
]=1
1
(1)()
(1) = (1) = 0.54 + 0.46 cos [
] = 0.54
2
(2)()
(2) = (2) = 0.54 + 0.46 cos [
] = 0.08
2

Windowed impulse response


(0) = (0) (0) = (0.05)(1) = 0.05
(1) = (1) = (1) (1) = (0.01166027182)(0.54) = 6.30103
(2) = (2) = (2) (2) = (0.04436734622)(0.08) = 3.55103

0 = 4 = 3.55103
1 = 3 = 6.30103
b2 = 0.05

Transfer function
() = . + . + . + . .

Difference equation

() =

()
= 3.55103 + 6.30103 1 + 0.05z 2 + 6.30103 3 3.55103 4
()

() = 3.55103 () + 6.30103 1 () + 0.05z 2 () + 6.30103 3 ()


3.55103 4 ()

() = . () + . ( ) + . ( ) + . ( )
. ( )

Magnitude frequency response


( ) = 3.55103 + 6.30103 + 0.05 2 + 6.30103 3 3.55103 4
( ) = (3.55103 ej + 6.30103 + 0.05ej + 6.30103 2 3.55103 3 )

( ) = {3.55103 [cos + sin ] + 6.30103 + 0.05[cos() + sin() ]


+ 6.30103 [cos(2) + sin(2) ] 3.55103 [cos(3) + sin(3) ]}
( ) = {. [ + ] + . + . [() () ]
+ . [() () ] . [() () ]}
|( )| = |{3.55103 [cos + sin ] + 6.30103 + 0.05[cos() sin() ]
+ 6.30103 [cos(2) sin(2) ] 3.55103 [cos(3) sin(3) ]}|

H(ej )={
+
{3.55103 [cos + sin ]+6.30103 +0.05[cos() sin() ]+6.30103 [cos(2) sin(2) ]3.55103 [cos(3) sin(3) ]}>0
{3.55103 [cos + sin ]+6.30103 +0.05[cos() sin() ]+6.30103 [cos(2) sin(2) ]3.55103 [cos(3) sin(3) ]}<0

2
3
4

|( )|

|( )|

H(ej )

0
1000

{3.55103 [cos + sin ]


+ 6.30103
+ 0.05[cos() sin() ]
+ 6.30103 [cos(2) sin(2) ]
3.55103 [cos(3)
sin(3) ]}
0.0555
0.04-0.04i=0.06-0.79

0.0555
0.06

-25.11
-24.44

180
135

2000

-0.0571i=0.0571-1.57

0.0571

-24.87

90

3000

-0.02905533906-0.029i= 0.04-2.36

0.04

-27.96

45

4000

-0.0303

0.0303

-30.37

Plot
() = 3.55103 + 6.30103 1 + 0.05z 2 + 6.30103 3 3.55103 4

[hz, w] = freqz( [-3.55x10^-3 6.30x10^-3 0.05 6.30x10^-3 -3.55x10^-3], [1], 512);


phi= 180*unwrap(angle(hz))/pi;
plot(w,20*log10(abs(hz))),grid;
xlabel(Frequency (radians));
ylabel(Magnitude Response (dB))

7.5. Given an FIR lowpass filter design with the following specifications:
Passband (fpass)= 0800 Hz
Stopband (fstop)= 1,2004,000 Hz
Passband ripple = 0.1 dB
Stopband attenuation =40 dB
Sampling rate (fs) = 8,000 Hz,
determine the following:

a. window method
b. length of the FIR filter

c. cutoff frequency for the design equation.

Solution:
a. window method
Passband ripple = 0.1 dB
Hence, it is hanning window method

b. length of the FIR filter


=

| | 1200 800
=
= 0.05

8000
=

3.1
3.1
=
=
0.05

c. cutoff frequency for the design equation.

+ 800 + 1200
=
=
2
2

7.7. Given an FIR bandpass filter design with the following specifications:
Lower cutoff frequency (fl) = 1,500 Hz
Lower transition width =600 Hz
Upper cutoff frequency(fh) =2,300 Hz
Upper transition width = 600 Hz
Passband ripple =0.1 dB
Stopband attenuation = 50 dB
Sampling rate(fs) = 8,000 Hz,

determine the following:

a. window method
b. length of the FIR filter
c. cutoff frequencies for the design equation.
Solution:
a. window method
Passband ripple = 0.1 dB
Hence, it is hamming window method

b. length of the FIR filter


1 =
2 =

1500600
8000

= 0.1125

2300 600
= 0.2125
8000

5
= 44.4
0.1125

c. cutoff frequencies for the design equation


Lower cutoff frequency (fl) = 1,500 Hz
Upper cutoff frequency(fh) =2,300 Hz

7.9. Given an FIR system


() = . . + . ,
realize H(z) using each of the following specified methods:
a. transversal form, and write the difference equation for implementation
b. linear phase form, and write the difference equation for implementation.

Solution:
a. transversal form, and write the difference equation for implementation
() =

()
= .25 0.5 1 + 0.25 2
()

() = 0.25() 0.5 1 () + 0.25 2 ()


() = . () . ( ) + . ( )

b. linear phase form, and write the difference equation for implementation.
() =

()
= .25 0.5 1 + 0.25 2
()

() = 0.25() 0.5 1 () + 0.25 2 ()


() = 0.25() 0.5( 1) + 0.25( 2)
() = . [() + ( )] . ( )

7.11. Determine the transfer function for a 5-tap FIR lowpass filter with a lower cutoff frequency of
2,000 Hz and a sampling rate of 8,000 Hz using the frequency sampling method.

Solution:
= 2 + 1 = 5
=2

2
, = 0,1,2
5

0 = 0 , 0 = 1
2
1 = , 1 = 1
5
4
2 = , 2 = 0
5
Specifications

0.5

= 2 = 2(2000) (
)=
8000
2

Frequency Sampling
2

1
2( 3)
() = {1 + 2 cos [
]} , = 0,1,2
5
7
=1

FIR filter coefficients

1
4
(0) = {1 + 2 cos [
]} = 0.1236
5
5
1
2
(1) = {1 + 2 cos [
]} = 0.3236
5
5
1
0
(2) = {1 + 2 cos [ ]} = 0.6
5
5

0 = 4 = 0.1236
1 = 3 = 0.3236
2 = 0.6
() = . + . . + . + . .

7.13. Given the following specifications:

a 7-tap FIR bandpass filter


a lower cutoff frequency of 1,500 Hz and an upper cutoff frequency of 3,000 Hz
a sampling rate of 8,000 Hz
the frequency sampling design method,

determine the transfer function.

= 2 + 1 = 7
=4

2
, = 0,1,2
5

0 = 0 , 0 = 0
2
1 = , 1 = 0
7
4
2 = , 2 = 1
7

6
3 = , 3 = 0
7
Specifications

1
1

0
0

0.35

0.75

1
3
= 2 = 2(1500) (
)=
8000
8
= 2 = 2(3000) (

1
3
)=
8000
4

Frequecny Sampling
3

1
2( 3)
() = {0 + 2 cos [
]} , = 0,1,2
7
7
=1

FIR filter coefficients


1
6
(0) = {2 cos [
]} = 0.2574
7
7
1
4
(1) = {2 cos [
]} = 0.0636
7
7
1
2
(2) = {2 cos [
]} = 0.1781
7
7
1
0
(2) = {2 cos [ ]} = 0.2857
7
7
0 = 6 = 0.1781
1 = 5 = 0.2574
2 = 4 = 0.0636

3 = 0.2857
() = . . . + . . .
+ .
7.15. In a speech recording system with a sampling rate of 10,000 Hz, the speech is corrupted by
broadband random noise. To remove the random noise while preserving speech information, the
following specifications are given:
Speech frequency range = 03,000 kHz
Stopband range = 4,0005,000 Hz
Passband ripple = 0.1 dB
Stopband attenuation = 45 dB
FIR filter with Hamming window.
Determine the FIR filter length (number of taps) and the cutoff frequency; use MATLAB to design the
filter; and plot the frequency response.
=

| | 4000 3000
=
= 0.1

10000

FIR filter length


=

3.3 3.3
=
=
0.1

cutoff frequency

+ 3000 + 4000
=
=
2
2

7.17. A digital crossover can be designed as shown in Figure 7.43.

Given the following audio specifications:


Sampling rate = 44,100 Hz
Crossover frequency = 2,000 Hz
Transition band range = 1,600 Hz
Passband ripple = 0.1 dB
Stopband attenuation = 50 dB
Filter type = FIR, determine the following for each filter:
a. window function
b. filter length
c. cutoff frequency.
Use MATLAB to design and plot frequency responses for both filters.
Solution:
a. window function
Lowpass filter: Hamming Window method
Highpass filter: Hamming Window method

b. filter length
=
= =

1600
= 0.0363
44100

3.3
= 90.91
0.0363

c. cutoff frequency
=
() = () =

You might also like