Professional Documents
Culture Documents
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.
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.
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
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;
Algorithm
1. Get the passband and stopband ripples.
2. Get the passband and stopband edge frequencies,
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.
[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.
4
Results and Inference
Total 10