Escolar Documentos
Profissional Documentos
Cultura Documentos
The Gibbs oscillations mainly result from the abrupt truncation of the
infinite-length coefficient sequence of impulse response of the FIR filter.
A window function is a symmetrical function which can gradually weight
the designed FIR coefficients down to zeros at both ends of for the range
M n M . Applying the window sequence to the filter coefficients gives
hw ( n )=h ( n ) w ( n )
Example 7.5
(a) Calculate the filter coefficients for a 3-tap FIR lowpass filter
with a cutoff frequency of 800 Hz and a sampling rate of 8000 Hz
using the Hamming window function.
(b) Determine the transfer function and difference equation of
the designed FIR system.
(c) Compute and plot the frequency response.
Solution
Part (a): We first determine the normalized cutoff frequency
800
c =2 f c T s =2 =0.2 radians
8000
{
c
, n=0
h ( n )=
sin ( c n )
M n M
n
Therefore,
c 0.2
h ( 0 )= = =0.2
It can be written as
H ( e j )= {,
+
0.2+ 0.02994 cos ( ) >0
0.2+ 0.02994 cos ( ) <0
Example 7.6
(a) Design a 5-tap FIR bandreject filter with a lower cutoff frequency of
2000 Hz, an upper cutoff frequency of 2400 Hz and a sampling rate of
8000 Hz using the Hamming window method.
(b) Determine the transfer function.
Solution
Part (a): We first determine the normalized cutoff frequencies
2000
L=2 f L T s=2 =0.5 radians
8000
2400
H =2 f H T s=2 =0.6 radians
8000
{
H + L
n=0
h ( n )=
sin ( H n ) sin ( H n )
+ 2 n 2
n n
Therefore,
H + L 0.6 +0.5
h ( 0 )= = =0. 9
p dB=20 log 10 ( 1+ p )
s dB=20 log 10 ( s )
Stopban
Window Passban d
Window Window d Ripple Attenuat
Function w ( n ) , M n M
Type Length (dB) ion (dB)
Rectangul 1 N=0.9 / f 0.7416 21
ar
Hanning
0 .5+ 0 .5 cos ( nM ) N=3.1/ f 0.0546 44
Hamming
0 .54 +0 . 46 cos ( nM ) N=3.3 / f 0.0194 53
Blackman
0 . 42+0 . 5 cos ( nM )+ 0. 08 cos ( 2n
M )
N=5.5 / f 0.0017 74
Example 7.10
Design a bandpass FIR filter with the following specifications:
Lower Stopband = 0 - 500 Hz
Passband = 1600 - 2300 Hz
Upper Stopband = 3500 - 4000 Hz
Stopband Attenuation = 50 dB
Passband ripple = 0.05dB
Sampling rate = 8000 Hz
Determine the FIR filter length and the cutoff frequency to be used in
the design equation.
Solution
We first determine the normalized transition band
|1600500|
f 1= =0.137 5
8000
|350023 00|
f 2= =0.15
8000
3.3
N 2= =22
0.15
Department of Computer Engineering
College of Computer & Information Sciences, King
Saud University
Ar Riyadh, Kingdom of Saudi Arabia
CEN352 Digital Signal Processing by
Dr. Anwar M. Mirza
Lecture No. 22
Date: December, 2012
The lower and higher cutoff frequencies for the bandpass filter will be
1600+500
f 1= =1050 H z
2
3500+2300
f 1= =2900 H z
2
The normalized lower and higher cutoff frequencies for the bandpass
filter will be
1050
L=2 f L T s=2 =0.2625 radians
8000
2 9 00
H =2 f H T s=2 =0. 725 radian s
8000
In this case 2 M +1=25 will be the number of taps for the bandpass filter.
%
A MATLAB program
% Exampleto7.10
plot the frequency response is given in the following.
%
Ntap = 25; % number of filter taps
Ftype = 3; % lowpass filter
WnL = 0.2625*pi; % lower cutoff frequency
WnH = 0.725*pi; % upper cutoff frequency
Wtype = 4; % Hamming window type
fs = 8000; % sampling rate
% use firwd to compute B coefficients
B = firwd(Ntap, Ftype, WnL, WnH, Wtype);
A = 1;
omega = 0:0.01:pi;
fHz = omega*fs/(2*pi);
% frequency response of the fir filter
[hz, w] = freqz(B, A, omega);
magnitude = 20*log10(abs(hz));
phase = 180*unwrap(angle(hz))/pi;
figure, Department of Computer Engineering
College of Computer & Information Sciences, King
subplot(2,1,1); plot(fHz, Saud University
magnitude,'k','LineWidth',2); grid on; Ar Riyadh, Kingdom of Saudi Arabia