Finite Impulse Response Filter Design: DSP Labs
Finite Impulse Response Filter Design: DSP Labs
Filter Design
DSP Labs
Window Method
• The MATLAB function firwd(N,Ftype,WnL,WnH,Wtype)
The program, firwd(N,Ftype,WnL,WnH,Wtype), listed in the
‘‘MATLAB Programs’’ section in Program 7.14, has five input
parameters:
– ‘‘N’’ is the number of specified filter coefficients (the number of filter
taps).
– ‘‘Ftype’’ denotes the filter type, that is, input ‘‘1’’ for the lowpass
filter design, input ‘‘2’’ for the highpass filter design, input ‘‘3’’ for the
bandpass filter design, and input ‘‘4’’ for the band reject filter design.
– ‘‘WnL’’ and ‘‘WnH’’ are the lower and upper cutoff frequency inputs,
respectively.
• Note that WnH = 0 when specifying WnL for the lowpass filter design, while WnL
= 0 when specifying WnH for the highpass filter design.
– ‘‘Wtype’’ specifies the window data sequence to be used in the
design, that is, input ‘‘1’’ for the rectangular window, input ‘‘2’’ for
the triangular window, input ‘‘3’’ for the Hanning window, input ‘‘4’’
for the Hamming window, and input ‘‘5’’ for the Blackman window.
Example-1
a. Design a lowpass FIR filter with 25 taps using the MATLAB program. The
cutoff frequency of the filter is 2,000 Hz, assuming a sampling frequency
of 8,000 Hz. The rectangular window and Hamming window functions
are used for each design.
b. Plot the frequency responses along with those obtained using the
rectangular window and Hamming window for comparison.
2000 2
c = = 0.5 radians
8000
• Program 7.14. MATLAB function for FIR filter design using the window
method.
b. Program 7.2 is used to generate FIR filter coefficients using the
rectangular window.
– Its frequency responses will be plotted together with that obtained using the Hamming
window for comparison, as shown in Program 7.3.
Program 7.2
– Results of the FIR filter design using the Hamming window are illustrated in Program 7.3.
Program 7.3
– As a comparison, the frequency responses achieved from the rectangular window and
the Hamming window
• The FIR filter coefficients for both methods are listed in table below:
Exercise-1
Design a 41-tap lowpass FIR filter whose cutoff frequency is 1,600 Hz using
the following window functions. Assume that the sampling frequency is 8,000
Hz.
List the FIR filter coefficients and plot the frequency responses for each case.
Exercise-2
Design a 31-tap highpass FIR filter whose cutoff frequency is 2,500 Hz using
the following window functions. Assume that the sampling frequency is 8,000
Hz.
List the FIR filter coefficients and plot the frequency responses for each
design.
Exercise-3
Design a 41-tap bandpass FIR filter with the lower and upper cutoff
frequencies being 2,500 Hz and 3,000 Hz, respectively, using the following
window functions. Assume a sampling frequency of 8,000 Hz.
List the FIR filter coefficients and plot the frequency responses for each
design.
Exercise-4
Design a 41-tap band reject FIR filter with frequencies 2,500 Hz and 3,000 Hz,
respectively, using the Hamming window function. Assume a sampling
frequency of 8,000 Hz.
List the FIR filter coefficients and plot the frequency responses for each
design.