Академический Документы
Профессиональный Документы
Культура Документы
1. Write a program to evaluate and plot the DTFT. (Referred Prog. P3_1 page no. 39 of DSP labmanual of
Sanjit K Mitra)
clc;
clear all;
close all;
w = -4*pi:8*pi/511:4*pi;
num = [2 1];den = [1 -0.6];
h = freqz(num, den, w);
% Plot the DTFT
subplot(2,1,1);
plot(w/pi,real(h));grid
Lab exercise
1. Modify Program P3_1 to compute and plot the magnitude and phase spectra of a moving average filter of
Eq.
for three different values of length M and for 0 ≤ ω ≤2π. Justify the type of symmetries exhibited by the
magnitude and phase spectra. What type of filter does it represent ?
clc;
clear all;
close all;
1
w=-pi:pi/511:pi;
n=4;
i=1;
for m=2:2:n*2
num=(1/m)*ones(1,m);
h=freqz(num,1,w);
subplot(n,2,i),plot(w/pi,abs(h));
i=i+1;
subplot(n,2,i),plot(w/pi,angle(h));
i=i+1;
end
2. Compute and plot the frequency response of the following system. Based on your plots, comment on what
kind of system this is (lowpass, highpass, etc.).
clc;
clear all;
close all;
w=-pi:pi/511:pi;
2
num=[0.008 -0.033 0.05 -0.033 0.008];
den=[1 2.37 2.7 1.6 0.4];
h=freqz(num,den,w);
subplot(2,1,1),plot(w/pi,abs(h));
subplot(2,1,2),plot(w/pi,angle(h));
Post Lab
FIR system 1:
bLP =[
FIR system 2:
bBP =[
3
-0.0419 -0.1134 -0.0802 0.0000 0.0458 0.0363 0.0073 …
Plot the frequency responses using function freqz() for each of systems.
clc;
clear all;
close all;
w = -4*pi:8*pi/511:4*pi;
bLP =[-0.0012 -0.0025 -0.0045 -0.0068 -0.0073 -0.0030 0.0089 0.0297 0.0583 0.0907 0.1208 0.1422
bBP =[0.0004 -0.0017 -0.0064 -0.0076 0.0073 0.0363 0.0458 0.0000 -0.0802 -0.1134 -0.0419 0.0860
h1 = freqz(bLP, 1, 512,8000);
h2 = freqz(bBP, 1, 512,8000);
Conclusion:
DTFT is used to calculate the frequency spectrum of a discrete time signal which results into a continuous
function of But since the computer can handle only finite values, we use the function 'freqz()' which
4
computes DTFT at a prescribed set of discrete frequencies.
Thus the frequency response of LTI sysytems like moving average system and filters can be computed.