47
PROGRAM 15
Object : To design a FIR low-pass filter with given specifications and verify the magnitude, phase
and impulse responses using FDA Toolbox Order=100, rectangular window, cut-off frequency in
rad/s= 0.4
Tool used : MATLAB R2010b and FDA Toolbox
Theory :
Finite Impulse Response (FIR) Filter: The FIR filters are of non-recursive type, whereby the present
output sample is depending on the present input sample and previous input samples. The transfer
function of a FIR causal filter is given by
H(z) =
where h(n) is the impulse response of the filter.
The Fourier transform of h(n)is
H(ejw) = h(n)e-jwn
In the design of FIR filters most commonly used approach is using windows. The desired frequency
response Hd(ejw) of a filter is periodic in frequency and can be expanded in Fourier series. The
resultant series is given by
hd(n) = (1/2) H(ejw)ejwn dw
And known as Fourier coefficients
having infinite length. One possible way of obtaining FIR filter is to truncate the infinite Fourier
series at n = [(N-1)/2] where N is the length of the desired sequence. The Fourier coefficients of
the filter are modified by multiplying the infinite impulse response with a finite weighing
sequence w(n) called a window.
where w(n) = w(-n) 0
for |n| [(N-1)/2]
=0
for |n| > [(N-1)/2]
After multiplying w(n) with hd(n), we get a finite duration sequence h(n) that satisfies the desired
magnitude response,
h(n) = hd(n) w(n)
for
|n| [(N-1)/2]
=0
for
|n| > [(N-1)/2]
The frequency response H(ejw) of the filter can be obtained by convolution of Hd(ejw)
and W(ejw) is given by
H(ejw) = (1/2) Hd(ej) W(ej(w-) d
H(ejw) = Hd(ejw) * W(ejw)
48
Source Code :
clc;
clear all;
wc=input('enter the value of cut off frequency : ');
N=input('enter the order of filter : ');
b=fir1(N,wc,rectwin(N+1));
freqz(b,1);
impz(b,1,100);
Result :
enter the value of cut off frequency : 0.4
enter the order of filter : 100
49
FDA Tool :
50
Conclusion : Successfully designed the FIR low-pass filter with specified parameters using
MATLAB commands and verified the magnitude, phase and impulse responses using the FDA
Toolbox as shown in the figure