You are on page 1of 5

Expt.

No :6 Date:

F I R D I G I TA L F I LT E R D E S I G N U S I N G
WINDOWS

Aim
1. To plot the window functions using wvtool in MATLAB.
2. To design FIR lowpass digital filters using rectangular,Hamming,
Hanning and Blackman windows.
3. To design FIR low pass digital filters using Kaiser windows.

4. To design low pass, highpass and bandpass filers using rectangular,Hamming,


Hanning, and Blackman windows.

Theory Overview
The time domain classification of a digital filter based on the length of its impulse response
sequence leads to the finite impulse response(FIR) filter. There are four types of ideal
filters(LPF,HPF,BPF,BSF) are usually defined based on the magnitude function |H(ejω
)|.These ideal filters have doubly infinite impulse responses and are unrealizable as they are
not causal. In practice, realizable approximations to the ideal filters can be made. The design
of FIR filter is therefore based on a direct approximation of the specified magnitude
response .A variety approaches has been proposed for the design of FIR filters like Fourier
series method, frequency sampling method and sub optimal method. A direct and straight-
forward method is based on truncating the Fourier series representation of the prescribed
frequency response using windows.

Filter Design Specifications

The desired magnitude |G(ejω )| of a lowpass filter is shown in Fig.1. As indicated in the
figure, the passband defined by 0 ≤ ω ≤ ωp and require that the magnitude approximates unity
with an error of ±δp: that is as in equation(1)
1 − δp ≤ |G(ejω)| ≤ 1 + δp, for |ω| ≤ ωp (1)
In the stopband, defined by ωs ≤ω ≤π, the magnitude approximates zero with an error
bound of δs; that is as in equation(2)
|G(ejω)| ≤ δs, for ωs ≤ |ω| ≤ π (2)
The frequencies ωp and ωs are respectively, called the passband edge frequency and the
stopband edge frequency.The limits of the tolerances in the passband and stopband, δp and δp,
are usually called the peak ripple values.
Hence the digital filter specifications are ωp, ωs, δp and δs.

1
Fig 1: Typical magnitude specifications of digital LPF

Design of FIR filter using windows:


The ideal response of various filters namely lowpass,highpass,bandpass and
bandstop are given in Table I.
Table I Ideal response of various filters

fc , f1 and f2 are the normalized passband or stopband edge frequencies; N is the length of
filter. Table II gives relation between the order, stopband attenuation and window type of
various windows.

2
Table II Window type, stopband attenuation and order of various window functions.

Window Functions
The commonly used windows are shown in Fig.2 and the window functions are as
follows;

Fig 2: Plots of fixed windows

Algorithm
1. Get the passband and stopband ripples.
2. Get the passband and stopband edge frequencies,

3. Get the sampling frequency.

4. Calculate cut off frequency form pass band and stopband frequencies.
5. Choose suitable type of window from Table II based on the stopband attenuation.
6. Calculate the order of the filter using Table II relation.

3
7. Find the filter coefficients.
8. Draw the magnitude responses.

Matlab Programs
1. Design a low pass,highpass,bandpass and bandstop digital FIR filters satisfying the
follow- ing specifications. Passband cutoff frequency, fp=1500Hz,stopband
frequency fs=2000Hz and sampling frequency is f =9000Hz. The passband and
stop band ripples δp and δs are
0.05 and 0.04 respectively. Stopband attenuation is 22dB.
Write a matlab program for the design of filter using rectangular window and
plot the magnitude responses of the filters.
2. Design a low pass,highpass,bandpass and bandstop digital FIR filters satisfying the
following specifications. Passband cutoff frequency, fp=1500Hz,stopband
frequency fs=2000Hz and sampling frequency is f =8000Hz. The passband and
stop band ripples δp and δs are
0.04 and 0.02 respectively.Stopband attenuation is 45dB.
Write a matlab program for the design of filter using Blackman window and
plot the magnitude responses of the filters.

Matlab Syntax and Description


b = fir1(n,Wn,ftype,window) designs a lowpass, highpass, bandpass, bandstop,
filter, depending on the value of ftype, the number of elements of Wn and type of
window.

[h,w] = freqz(b,a,n) returns the n-point frequency response vector h and the
corresponding angular frequency vector w for the digital filter with transfer function
coefficients stored in b and a.
Write a switch case syntax for various window function and filter types.

References
[1] https://in.mathworks.com/support.html.
[2] Dimitris G.Monolakis John G.Prokais. Digital Signal Processing,Principles,
Algorithms and Applications. The Prentice Hall International Ins, 1996.

[3] Sanjit K Mitra. Digital Signal Processing, A Computer-Based Approach. The


Mcgrawhill Publish- ing Companies, 2008.

4
Results and Inference

Name: ________________________________________ Reg. No.: ________________________

Date of Experiment : …………… ASSESSMENT


Date of Report Submission : …………… Student Task Max. Marks Graded Marks
Submission Delay: …........
Conduction 5

Signature Results & Conclusion 5

Total 10

You might also like