Lab Sheet 6 Filter Design Using MATLAB: Lab Session 6.1: Implementation of Linear Phase FIR Filter
Lab Sheet 6 Filter Design Using MATLAB: Lab Session 6.1: Implementation of Linear Phase FIR Filter
Filter Design 6
using MATLAB
• A fundamental knowledge on MATLAB
This approach is the most popular one in practice and is used for both FIR and IIR filters.
• band [0, ωp] is called the passband, and δ1 is the tolerance (or ripple) that we are
willing to accept in the ideal passband response,
• band [ωs, π] is called the stopband, and δ2 is the corresponding tolerance (or
ripple),
• band [ωp, ωs] is called the transition band, and there are no restrictions on the
magnitude response in this band.
A typical relative specification of a lowpass filter is shown in Figure 6.1b,
in which
• Rp is the passband ripple in dB.
• As is the stopband attenuation in dB.
The parameters given in these two specifications are obviously related.
Since |H(ejω)|max in absolute specifications is equal to (1 + δ1), we have
Example 6.0 : In a certain filter’s specifications the passband ripple is 0.25 dB, and the
stopband attenuation is 50 dB. Determine δ1 and δ2.
Solution:
Type
I symmetric
II symmetric
III anti-symmetric
IV anti-symmetric
MATLAB Code:
Output:
Similar problems:(Solve in lab)
Type-2:
Type-3:
Type-4:
Example 6.2
Design a 48th-order FIR bandpass filter with passband 0.35 ≤ w ≤ 0.65.
MATLAB Code:
Output:
Example 6.3
Design a lowpass filter with passband defined from 0 to 1 kHz and stopband
defined from 1500 Hz to 4 kHz. Specify a passband ripple of 5% and a
stopband attenuation of 40 dB. Use kaiserord FIR order estimator (lowpass,
highpass, bandpass, multiband).
MATLAB Code:
If empty or omitted, fir1 uses a Hamming window of length n+1.
Output:
W = kaiser(N,BTA) returns the BETA-valued N-point Kaiser window.
Task1: Try changing the parameters such as fcuts and fsamp and make comments in your
report. There is a restriction between cut-off frequency and sampling frequency, can you find
that ?
Task2: Use Rectangular, Hamming, Hanning and Blackman window instead of Kaiser
window (use same window length). Which one is the best? and make comments in your report.
W=window(@rectwin,n+1)
W=window(@hamming,n+1)
W=window(@hann,n+1)
W=window(@blackman,n+1)
Output:
Task1: Try changing the parameters and make comments in your report
Example 6.5: Design a digital FIR lowpass filter with the following specifications:
Choose Hamming window function. Determine the impulse response and provide a plot of the
frequency response of the designed filter.
Solution:
MATLAB Code:
Output:
At command window:
M = 67 wc = 0.7854 As = 52
Comment: Note that the filter length is M = 67, the actual stopband attenuation is 52 dB,
and the actual passband ripple is 0.0394 dB. Clearly, the passband ripple is satisfied by this
design. This practice of verifying the passband ripple is strongly recommended.
Example 6.6:
Repeat the Example using Kaiser window.
MATLAB Code:
Output:
At Command window: M = 61 beta = 4.5513 As = 52
Example 6.7:Design the following digital bandpass filter using Blackman window.
Output:
At command window:
r_width = 0.4712, M =75.Rp = 0.0030,As = 75
Lab Session 6.3: In Lab Evaluation
ILE6.1
Homework:
1.
2.
3.
4.