Professional Documents
Culture Documents
Submitted By:
Name: HAIDER ALI MUNIR
ID No: 170887
Class/Sec: BEEP V-B
Submitted To: MAM ANUM ZULQARNAIN
Instructor’s Remarks:
Additional Remarks:
______________________________________________________
Instructor’sSignature:_____________
Objective:- The goal of this laboratory is to gain familiarity with the
frequency response of the signals and systems.
Program P7_1 can be used to evaluate and plot the DTFT
MATLAB CODE:
w = -4*pi:8*pi/511:4*pi;
num = [2 1];den = [1 -0.6];
h = freqz(num, den, w);
subplot(2,1,1)
plot(w/pi,real(h))
grid on
hold on
title('Real part of H(e^{j\omega})')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,1,2)
plot(w/pi,imag(h))
grid on
hold on
title('Imaginary part of H(e^{j\omega})')
xlabel('\omega /\pi');
ylabel('Amplitude');
pause
subplot(2,1,1)
plot(w/pi,abs(h));
grid on
hold on
title('Magnitude Spectrum |H(e^{j\omega})|')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,1,2)
plot(w/pi,angle(h));
grid on
hold on
title('Phase Spectrum arg[H(e^{j\omega})]')
xlabel('\omega /\pi');
ylabel('Phase, radians' );
plot:
Question 7.1:
Pause Command:
Question 7.2:
Following is the Real and imaginary part of the function that are displayed speratly .
Following is the magnitude and phase angle to be displayed by use of the pause command.
w = 0:pi/511:2*pi;
num = [0.7 -0.5 0.3 1];den = [1 0.3 -0.5 0.7];
h = freqz(num, den, w);
subplot(2,1,1)
plot(w/pi,real(h))
grid
title('Real part of H(e^{j\omega})')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,1,2)
plot(w/pi,imag(h))
grid
title('Imaginary part of H(e^{j\omega})')
xlabel('\omega /\pi');
ylabel('Amplitude');
pause
subplot(2,1,2)
plot(w/pi,abs(h));
grid
title('Magnitude Spectrum |H(e^{j\omega})|')
xlabel('\omega /\pi');
ylabel('Amplitude');
subplot(2,1,2)
plot(w/pi,angle(h));
grid
title('Phase Spectrum arg[H(e^{j\omega})]')
xlabel('\omega /\pi');
ylabel('Phase, radians' );
Result:
Following is the magnitude and phase angle to be displayed speratly by the use of the pause
command.
Observation:
We have observed that this DTFT is a repeating signal therefore, it is a periodic wave with the
period under ω, ω = 0 ≤ ω ≤ π .
Question 7.4:
Matlab code:
clf;
w = -pi:2*pi/255:pi; wo = 0.6*pi; D = 15;
num = [1 2 3 4 5 6 7 8 9];
h1 = freqz(num, 1, w);
h2 = freqz([zeros(1,D) num], 1, w);
subplot(2,2,1)
plot(w/pi,abs(h1))
grid on
hold on
title('The Magnitude Spectrum of our Original Sequence')
subplot(2,2,2)
plot(w/pi,abs(h2))
grid on
hold on
title('The Magnitude Spectrum of our Time-Shifted Sequence')
subplot(2,2,3)
plot(w/pi,angle(h1))
grid on
hold on
title('The Phase Spectrum of our Original Sequence')
subplot(2,2,4)
plot(w/pi,angle(h2))
grid on
hold on
title(' The Phase Spectrum of our Time-Shifted Sequence')
plot:
clf;
w = -pi:2*pi/255:pi; wo = 0.6*pi; D = 15;
num = [1 2 3 4 5 6 7 8 9];
h1 = freqz(num, 1, w);
h2 = freqz([zeros(1,D) num], 1, w);
subplot(2,2,1)
plot(w/pi,abs(h1))
grid on
hold on
title('The Magnitude Spectrum of our Original Sequence')
subplot(2,2,2)
plot(w/pi,abs(h2))
grid on
hold on
title('The Magnitude Spectrum of our Time-Shifted Sequence')
subplot(2,2,3)
plot(w/pi,angle(h1))
grid on
hold on
title('The Phase Spectrum of our Original Sequence')
subplot(2,2,4)
plot(w/pi,angle(h2))
grid on
hold on
title(' The Phase Spectrum of our Time-Shifted Sequence')
plot:
Code 2:(in this task we have just change our value of wo and D)
plot2:
2. Learning Outcomes:
The learning outcomes of our lab are as follows: