0% found this document useful (0 votes)
3 views28 pages

FIR Filter Design Techniques Explained

Uploaded by

kinglyxu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views28 pages

FIR Filter Design Techniques Explained

Uploaded by

kinglyxu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ELG4177 - DIGITAL SIGNAL PROCESSING

Tutorial 5

By:Mohamed Alouzi

© [Link] : 2021
Problems: 5.2, 5.9, 5.10, 5.52, 5.28, 5.8, 5.24, 5.36

© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
© [Link] : 2021
Introduction to Lab#4
FIR filter design

© [Link] : 2021
There two methods for FIR Design

• (A) Design with frequency sampling


• (B) Design with window functions

© [Link] : 2021
Design FIR (Type I) Illustration of (a) &(b)

n Shifted by M
M=(len-1)/2; % Type 1
k=0:(len-1);
wo=0.3*pi; % Passband edge
len=23; % Length of filter pd=exp(2*pi*j*(-M)*k/len);
pass_len=fix(wo*len/(2*pi))+1; % Passband Hd=Ad.*pd;
length h=real(ifft(Hd));
Ad=[ones(1,pass_len),zeros(1,len- h2=imag(ifft(Hd));
2*pass_len+1),ones(1,pass_len-1)]; figure; stem(h);hold on;
stem((1:len)/len,Ad); stem(h2, 'r');
xlabel('normalized frequency');
legend('real','imaginary');
ylabel('Amplitude');
title('ideal filter') xlabel('frequency');

© H. Jleed: 2018 ~
cont
[resp,omeg]=freqz(h);
figure;
subplot(211);plot(omeg,abs(resp));grid;
title('Magnitude Response');
subplot(212); plot(omeg,angle(resp), 'r.-');
hold on;
plot(omeg,unwrap(angle(resp))); title('Phase
Response');
hold
off;legend('wraped','unwraped','location','be
st')
figure;
plot(omeg,abs(resp)); title('Magnitude
Response');
hold on; plot(omeg,unwrap(angle(resp))/10,
'k'); title('Phase Response');

M=11

© H. Jleed: 2018 ~
h) Design a length-23 linear-phase FIR low-pass filter with a passband edge of   6 .
radians/sample using a window approach. Do not use a frequency sampling technique as in
a). Use the windowing approach with the following windows: rectangular, Hanning,
Hamming and Kaiser with   0.3 Find the frequency response of the resulting filters,
0
and compare with the filter found in a).

b1=fir1(len,wn,rectwin(N+1)); b2=fir1(len,wn,hann(N+1));
b3=fir1(len,wn,hamming(N+1)); b4=fir1(len,wn,kaiser(N+1,beta));

Windowed Coeffecients Magnitude response


0.3 20
rectangular rectangular
0.25 Hanning 0 Hanning
Hamming Hamming
Kaiser Kaiser
0.2 -20

0.15 -40
Amplitude

dB
0.1 -60

0.05 -80

0 -100

-0.05 -120

-0.1 -140
0 5 10 15 20 25 0 0.5 1 1.5 2 2.5 3 3.5
n samples rad/sec

The cut-off frequency “wn” must be


normalized between 0 < Wn < 1.0,
© H. Jleed: 2018 ~

You might also like