DSP LAB of Filter
DSP LAB of Filter
Objective:
The process of deriving the transfer function H(z) whose frequency response H(ejw) approximates
the given frequency response specifications is called digital filter design. After H(z) has been
obtained, it is then realized in the form of a suitable filter structure. In the previous laboratory
exercise, the realizations of FIR and IIR transfer functions have been considered. In this laboratory
exercise you will learn how to design an IIR or FIR digital filter to meet a specified magnitude or
gain response.
where the input parameters are the normalized pass band edge frequency Wp, the normalized stop band
edge frequency Ws, the pass band ripple Rp in dB, and the minimum stop band attenuation Rs in dB.
Both Wp and Ws must be a number between 0 and 1 with the sampling frequency assumed to be 2 Hz.
The output data are the lowest order N meeting the specifications and the normalized cutoff frequency
Wn. If Rp = 3 dB, then Wn = Wp. buttord can also be used to estimate the order of a high pass, a band
pass, and a band stop Butterworth filter. For a highpass filter design, Wp > Ws. For bandpass and
bandstop filter designs, Wp and Ws are two-element vectors specifying both edge frequencies, with the
lower edge frequency being the first element of the vector. In the latter cases, Wn is also a two-element
vector.
For estimating the order of a Type 1 Chebyshev filter, the MATLAB command is
For designing a Type 2 Chebyshev filter, the MATLAB command for estimating the order is
where the input parameters N and Wn are determined through the use of the function buttord, and
the output is the vectors num and den containing, respectively, the coefficients of the numerator
and denominator polynomials of the transfer function in ascending powers of z-1 . If Wn is a scalar,
butter returns a low pass transfer function of order N, and if Wn is a two-element vector, it returns
a band pass transfer function of order 2N. For designing a Butterworth digital high pass filter of
order N, the command is
The command
returns the transfer function of a Butterworth band stop filter of order 2N provided W n is a two
element vector. For designing a Type 1 Chebyshev digital filter, the commands are
A low pass transfer function of order N is returned in each case if W n is a scalar, and a band pass
transfer function of order 2N is returned if Wn is a two-element vector. In each of the above
commands, filter type is high for designing a high pass filter with Wn being a scalar, and filter type
is stop for designing a bandstop filter with Wn being a two-element vector.
with N an even integer, is used for designing a high pass filter. The command
with Wn a two-element vector, is employed for designing a band stop FIR filter.
Lab Task
1. Determine the lowest order of a digital IIR low pass filter of all four types in MATLAB.
The specifications are as follows: sampling rate of 40 kHz, pass band edge frequency of 4
kHz, stop band edge frequency of 8 kHz, pass band ripple of 0.5 dB, and a minimum stop
band attenuation of 40 dB. Comment on your results.
2. Determine the lowest order of a digital IIR high pass filter of all four types in MATLAB.
The specifications are as follows: sampling rate of 3,500 Hz, pass band edge frequency of
1,050 Hz, stopband edge frequency of 600 Hz, pass band ripple of 1 dB, and a minimum
stop band attenuation of 50 dB. Comment on your results.
3. Determine the lowest order of a digital IIR band pass filter of all four types in MATLAB.
The specifications are as follows: sampling rate of 7 kHz, pass band edge frequencies at 1.4
kHz and 2.1 kHz, stop band edge frequencies at 1.05 kHz and 2.45 kHz, pass band ripple of
0.4 dB, and a minimum stop band attenuation of 50 dB. Comment on your results.
4. Given: sampling rate of 20 kHz, δp = 0.002 and δS = 0.002, and stop band edge = 2.3 kHz.
Using the function fir1, design a linear-phase FIR low pass filter meeting the specifications
given above and plot its gain and phase responses. Estimate the order of filter. Does your
design meet the specifications? If it does not, adjust the filter order until the design meets the
specifications. What is the order of the filter meeting the specifications?
5. Design a Butterworth Bandstop Digital Filter.