Experiment Lab Report 6
Experiment Lab Report 6
Fall 2022
DIGITAL SIGNAL PROCESSING
LABORATORY EEE 3310
Lab Report – 6
Submitted to:
Dr. Khawza Iftekhar Uddin Ahmed
Submitted by:
GROUP 1
Name ID
Introduction: From this experiment we learned how to use digital filter using MATLAB and
we also saw different types of linear phase FIR filter. Furthermore, we also saw how to
implement these using MATLAB as well as we saw magnitude and phase response.
In Lab Evaluation:
Code:
%beta = 0.1102*(As - 8.7)
M = 45; As = 60; n=[0:1:M-1];
beta = 0.1102*(As - 8.7)
w_kai = (kaiser(M,beta))';
wc1 = pi/3; wc2 = 2*pi/3;
hd = ideal_lp(wc1,M) + ideal_lp(pi,M) - ideal_lp(wc2,M);
h = hd.* w_kai;
[db,mag,pha,grd,w] = freqz_m(h,(1));
subplot(2,2,1);
stem(n,hd); title('Ideal Impulse Response')
axis([-1 M -0.2 0.8]); xlabel('n'); ylabel('hd(n)')
subplot(2,2,2);
stem(n,w_kai);title('Kaiser Window')
axis([-1 M 0 1.1]); xlabel('n'); ylabel('w(n)')
subplot(2,2,3);
stem(n,h);title('Actual Impulse Response')
axis([-1 M -0.2 0.8]); xlabel('n'); ylabel('h(n)')
subplot(2,2,4);
plot(w/pi,db); axis([0 1 -80 10]);title('Magnitude
Response in dB');grid;
xlabel('frequency in pi units'); ylabel('Decibels')
Page 2 of 8
Homework:
Code:
Page 3 of 8
subplot(2,2,4);plot(w/pi,Hr/pi); title('Amplitude
Response');grid;
xlabel('frequency in pi units'); ylabel('slope in
piunits'); axis([0 1 0 1]);
Code:
n=[0:1:M-1]; wc1 = (ws1+wp1)/2; wc2 = (wp2+ws2)/2;
hd = ideal_lp(wc2,M) - ideal_lp(wc1,M);
w_han = (hann(M))';
h = hd .* w_han;
[db,mag,pha,grd,w] =freqz_m(h,[1]);
delta_w = 2*pi/1000;
Rp = -min(db(wp1/delta_w+1:1:wp2/delta_w)) ;
As = -round(max(db(ws2/delta_w+1:1:501)));
Page 4 of 8
subplot(2,2,1); stem(n,hd); title('Ideal
ImpulseResponse');
axis([0 M-1 -0.4 0.5]); xlabel('n'); ylabel('hd(n)');
subplot(2,2,2); stem(n,w_han);title('Blackman Window');
axis([0 M-1 0 1.1]); xlabel('n'); ylabel('w(n)');
subplot(2,2,3); stem(n,h);title('Actual Impulse
Response');
axis([0 M-1 -0.4 0.5]); xlabel('n'); ylabel('h(n)');
subplot(2,2,4);plot(w/pi,db);
title('Magnitude Response in dB');grid;
xlabel('frequency in pi units'); ylabel('Decibels');
axis([0 1 -150 10]);
Code:
Page 5 of 8
ws = 0.4*pi;wp = 0.6*pi;Rp = 0.004;As = 50;
tr_width = abs(wp-ws);
M = ceil(11*pi/tr_width); M = 2*floor(M/2)+1;
n = 0:M-1; w_blk = (blackman(M))';
wc = (ws+wp)/2;
hd = ideal_lp(pi,M)-ideal_lp(wc,M); h = hd .* w_blk;
[db,mag,pha,grd,w] = freqz_m(h,1); delta_w = pi/500;
Rpd = -min(db(ceil(wp/delta_w)+1:floor(pi/delta_w)+1));
Asd = floor(-max(db(1:(ws/delta_w)+1)));
Hf_1
=figure('Units','inches','position',[1,1,5,3],'color',[0,
0,0],'paperunits','inches','paperposition',[0,0,5,3]);
set(Hf_1,'NumberTitle','off','Name','P7.12');
plot(w(301:501)/pi,db(301:501),'linewidth',1);
title('Zoomed Magnitude Response in dB');
axis([0.6,1,-0.005,0.001]); xlabel('\omega/\pi');
ylabel('Decibels');
set(gca,'XTick',[0.6;1]);
set(gca,'XTickLabel',['0.6';' 1 '],'fontsize',8);
set(gca,'YTick',[-0.004;0]); set(gca,'YTickLabel',['-
0.004';' 0 ']);grid;
Page 6 of 8
CODE:
Page 7 of 8
Statement: I Have contributed and given my full support in completing this report.
Page 8 of 8