Lab 7
Lab 7
EE-20141
LAB SESSION 7
To study s-plane and plot impulse and frequency response for different pole-zero locations in s-
plane. Also, to determine whether the system is FIR or IIR.
clear all; close all; clc;
Num = poly([(0-(i*(pi/2))),(0+(i*(pi/2)))]);
Zeros = roots(Num); Den = poly([-1,-1]);
poles = roots(Den); sys = tf(Num,Den);
figure;
subplot(3,1,1);
pzmap(sys);
xlim([-2 2]); ylim([-4 4]);
subplot(3,1,2);
[mag phase w] = bode(sys);
mag = squeeze(mag);
plot(w,mag);
subplot(3,1,3);
impulse(sys);
H = dfilt.df1(Num,Den);A = isfir(H)
sys=tf(Num,Den)
zeros=roots(Num)
poles=roots(Den)
KINZA PERVEZ
EE-20141
LAB SESSION 7
figure('color','w')
subplot(3,1,1)
pzmap(sys)
xlim([-3 3])
ylim([-3 3])
subplot(3,1,2)
[H w]=freqs(Num,Den);
mag=abs(H);
plot(w,mag)
xlabel('Frequency (\omega)');
ylabel('Gain |H(\omega)|')
title('Frequency Response');
axis tight; grid
subplot(3,1,3)
impulse(sys,'r')
grid
TASK#2:
clear all; close all; clc;
Num = [1];
Den = poly([-0.5]);
sys=tf(Num,Den)
zeros=roots(Num)
poles=roots(Den)
KINZA PERVEZ
EE-20141
LAB SESSION 7
figure('color','w')
subplot(3,1,1)
pzmap(sys)
xlim([-3 3]); ylim([-3 3]);
subplot(3,1,2)
[H w]=freqs(Num,Den);
mag=abs(H);
plot(w,mag)
xlabel('Frequency (\omega)');
ylabel('Gain |H(\omega)|');
title('Frequency Response');
axis tight; grid;
subplot(3,1,3)
impulse(sys,'r'); grid;
Num = [1];
Den = poly([0.5]);
sys=tf(Num,Den)
zeros=roots(Num)
poles=roots(Den)
figure('color','w')
subplot(3,1,1)
pzmap(sys)
xlim([-3 3]); ylim([-3 3]);
KINZA PERVEZ
EE-20141
LAB SESSION 7
subplot(3,1,2)
[H w]=freqs(Num,Den);
mag=abs(H);
plot(w,mag)
xlabel('Frequency (\omega)'); ylabel('Gain |H(\omega)|')
title('Frequency Response')
axis tight; grid
subplot(3,1,3)
impulse(sys,'r'); grid;
Num = [1];
Den = poly([(0-(i*(pi/2))),(0+(i*(pi/2)))]);
sys=tf(Num,Den)
zeros=roots(Num)
poles=roots(Den)
figure('color','w')
subplot(3,1,1)
pzmap(sys)
xlim([-3 3]); ylim([-3 3]);
subplot(3,1,2)
[H w]=freqs(Num,Den);
mag=abs(H);
plot(w,mag)
KINZA PERVEZ
EE-20141
LAB SESSION 7
subplot(3,1,3)
impulse(sys,'r'); grid;
Num = [1];
Den = poly([(-0.5-(i*(pi/2))),(-0.5+(i*(pi/2)))]);
sys=tf(Num,Den)
zeros=roots(Num)
poles=roots(Den)
figure('color','w')
subplot(3,1,1)
pzmap(sys)
xlim([-3 3]); ylim([-3 3]);
subplot(3,1,2)
[H w]=freqs(Num,Den);
mag=abs(H);
plot(w,mag)
xlabel('Frequency (\omega)');
ylabel('Gain |H(\omega)|')
title('Frequency Response')
axis tight; grid
KINZA PERVEZ
EE-20141
LAB SESSION 7
subplot(3,1,3)
impulse(sys,'r'); grid;
‘
The system is oscillating and decaying.
TASK#6:
clear all; close all; clc;
Num = [1];
Den = poly([(0.5-(i*(pi/2))),(0.5+(i*(pi/2)))]);
sys=tf(Num,Den)
zeros=roots(Num)
poles=roots(Den)
figure('color','w')
subplot(3,1,1)
pzmap(sys)
xlim([-3 3]); ylim([-3 3]);
subplot(3,1,2)
[H w]=freqs(Num,Den);
mag=abs(H);
plot(w,mag)
xlabel('Frequency (\omega)');
ylabel('Gain |H(\omega)|')
title('Frequency Response')
axis tight; grid
subplot(3,1,3)
impulse(sys,'r'); grid;
KINZA PERVEZ
EE-20141
LAB SESSION 7
Num = poly([(0-(i*(pi/2))),(0+(i*(pi/2)))]);
Den = poly([(-0.2-(i*(pi/4))),(-0.2+(i*(pi/4)))]);
sys=tf(Num,Den)
zeros=roots(Num)
poles=roots(Den)
figure('color','w')
subplot(3,1,1)
pzmap(sys)
xlim([-3 3]); ylim([-3 3]);
subplot(3,1,2)
[H w]=freqs(Num,Den);
mag=abs(H);
plot(w,mag)
xlabel('Frequency (\omega)');
ylabel('Gain |H(\omega)|')
title('Frequency Response')
axis tight; grid
subplot(3,1,3)
impulse(sys,'r'); grid;
KINZA PERVEZ
EE-20141
LAB SESSION 7
Num = poly([(0-(i*(pi/2))),(0+(i*(pi/2)))]);
Den = poly([(0.2-(i*(pi/4))),(0.2+(i*(pi/4)))]);
sys=tf(Num,Den)
zeros=roots(Num)
poles=roots(Den)
figure('color','w')
subplot(3,1,1)
pzmap(sys)
xlim([-3 3]); ylim([-3 3]);
subplot(3,1,2)
[H w]=freqs(Num,Den);
mag=abs(H);
plot(w,mag)
xlabel('Frequency (\omega)');
ylabel('Gain |H(\omega)|')
title('Frequency Response')
axis tight; grid
subplot(3,1,3)
impulse(sys,'r'); grid;
KINZA PERVEZ
EE-20141
LAB SESSION 7
TASK#9:
clear all; close all; clc;
Num = poly([(-0.1-(i*(pi/2))),(-0.1+(i*(pi/2)))]);
Den = poly([(0-(i*(pi/2))),(0+(i*(pi/2)))]);
sys=tf(Num,Den)
zeros=roots(Num)
poles=roots(Den)
figure('color','w')
subplot(3,1,1)
pzmap(sys)
xlim([-3 3]); ylim([-3 3]);
subplot(3,1,2)
[H w]=freqs(Num,Den);
mag=abs(H);
plot(w,mag)
xlabel('Frequency (\omega)');
ylabel('Gain |H(\omega)|')
title('Frequency Response')
axis tight; grid
subplot(3,1,3)
impulse(sys,'r'); grid;
KINZA PERVEZ
EE-20141
LAB SESSION 7
Num = poly([(0.1-(i*(pi/2))),(0.1+(i*(pi/2)))]);
Den = poly([(0-(i*(pi/2))),(0+(i*(pi/2)))]);
sys=tf(Num,Den)
zeros=roots(Num)
poles=roots(Den)
figure('color','w')
subplot(3,1,1)
pzmap(sys)
xlim([-3 3]); ylim([-3 3]);
subplot(3,1,2)
[H w]=freqs(Num,Den);
mag=abs(H);
plot(w,mag)
xlabel('Frequency (\omega)');
ylabel('Gain |H(\omega)|')
title('Frequency Response')
axis tight; grid
subplot(3,1,3)
impulse(sys,'r'); grid;