Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 7

Name: M. Hamad Zaheer Roll no.

:07-E-28

PROBLEM 1

Problem 1 Matlab Code:

%PROBLEM NO. 1
%H(z)=(1-z^(-1))/20(1+0.9z^(-1))
a=[1 -1];
b=[1*20 0.9*20];
%pole-zero plot
figure(1)
zplane(a,b);
%frequency response
[H,w]=freqz(a,b,100,'whole');
%magnitude and phase response
magH=abs(H);
phaH=angle(H);
%magnitude and phase response plot
figure(2)
plot(w/pi,magH);
xlabel('Frequency in pi units');
ylabel('Magnitude');
figure(3)
plot(w/pi,phaH);
xlabel('Frequency in pi units');
ylabel('Phase in pi units');

Pole-Zero Plot:

0.8

0.6

0.4

0.2
Imaginary Part

-0.2

-0.4

-0.6

-0.8

-1

-1 -0.5 0 0.5 1
Real Part
Name: M. Hamad Zaheer Roll no.:07-E-28

Magnitude Plot:

0.9

0.8

0.7

0.6
Magnitude

0.5

0.4

0.3

0.2

0.1

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Frequency in pi units

Phase Plot:

1.5

0.5
Phase in pi units

-0.5

-1

-1.5

-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Frequency in pi units
Name: M. Hamad Zaheer Roll no.:07-E-28

PROBLEM 2

Problem 2 Matlab Code:


%PROBLEM NO. 2
%H(Z)=a/b=(1/3)(1+z^(-1)+z^(-2))
a=[1/3 1/3 1/3];
b=[1];
%frequency response
[H,w]=freqz(a,b,100,'whole');
%magnitude and phase response
magH=abs(H);
phaH=angle(H);
%magnitude and phase response plot
figure(1)
plot(w/pi,magH);
xlabel('Frequency in pi units');
ylabel('Magnitude');
figure(2)
plot(w/pi,phaH);
xlabel('Frequency in pi units');
ylabel('Phase in pi units');
Name: M. Hamad Zaheer Roll no.:07-E-28

Magnitude Plot:

0.9

0.8

0.7

0.6
Magnitude

0.5

0.4

0.3

0.2

0.1

0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Frequency in pi units

Phase Plot:

2.5

1.5

1
Phase in pi units

0.5

-0.5

-1

-1.5

-2

-2.5
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Frequency in pi units
Name: M. Hamad Zaheer Roll no.:07-E-28

PROBLEM 3

Problem 3a Matlab Code:


%PROBLEM NO. 3 a
%H(z)=(1-0.5z^(-1))/(1-(1/3)z^(-1))
a=[1 -1/2];
b=[1 -1/3];
%frequency response
[H,w]=freqz(a,b,100,'whole');
%magnitude and phase response
magH=abs(H);
phaH=angle(H);
%magnitude and phase response plot
figure(1)
plot(w/pi,magH);
xlabel('Frequency in pi units');
ylabel('Magnitude');
figure(2)
plot(w/pi,phaH);
xlabel('Frequency in pi units');
ylabel('Phase in pi units');

Problem 3b Matlab Code:

%PROBLEM NO. 3 b
%H(z)=sqrt(2(1-0.5^2))/(1-0.5z)
a=[sqrt(2*(1-0.5^2))];
b=[1 -0.5];
%frequency response
[H,w]=freqz(a,b,100,'whole');
%magnitude and phase response
magH=abs(H);
phaH=angle(H);
%magnitude and phase response plot
figure(1)
plot(w/pi,magH);
xlabel('Frequency in pi units');
ylabel('Magnitude');
figure(2)
plot(w/pi,phaH);
xlabel('Frequency in pi units');
ylabel('Phase in pi units');
Name: M. Hamad Zaheer Roll no.:07-E-28

Problem 3a Magnitude Plot:

1.2

1.15

1.1

1.05

1
Magnitude

0.95

0.9

0.85

0.8

0.75

0.7
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Frequency in pi units

Problem 3a Phase Plot:

0.25

0.2

0.15

0.1
Phase in pi units

0.05

-0.05

-0.1

-0.15

-0.2

-0.25
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Frequency in pi units
Name: M. Hamad Zaheer Roll no.:07-E-28

Problem 3b Magnitude Plot:

2.6

2.4

2.2

2
Magnitude

1.8

1.6

1.4

1.2

0.8
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Frequency in pi units

Problem 3b Phase Plot:

0.6

0.4

0.2
Phase in pi units

-0.2

-0.4

-0.6

-0.8
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Frequency in pi units

You might also like