You are on page 1of 9

Waqar azeem Sp10-Bet-086 Usman Jalil Paracha FA11-BET-105

Task-1:
Using MATLAB we determine the partial-fraction expansion of the z-transform X(z)
given by
18z3
X(z) =
18z3 + 3z2 – 4z -1
CODE:

clc
clearall;
closeall;
a=[18];
b=[18,3,-4,-1];
[R,P,K]=residuez(a,b)
[a,b]=residuez(R,P,K)

RESULT:

R=

-0.4538 + 0.0216i
-0.4538 - 0.0216i
-0.0924

P=

0.1789 + 0.5085i
0.1789 - 0.5085i
-0.1912

K=

[]

a=

-1.0000 -0.0000 0

b=

1.0000 -0.1667 0.2222 0.0556


Method 2:
>> a=[0 18];
>> b=[18 3 -4 -1];
>> [h,n]=impz(a,b)

h=

0
1.0000
-0.1667
0.2500
-0.0231
0.0502
0.0004
0.0098
0.0012
0.0020
0.0005
0.0004
0.0001
0.0001
0.0000

n=

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14

>> stem(n,h)
1.2

0.8

0.6

0.4

0.2

-0.2
0 2 4 6 8 10 12 14

Task-2:
Determine the inverse z-transform of the 11 terms of following equation
1- 2z-1
X(z) =
(1-0.2z-1)(1+0.6z-1)
CODE:

clc
clearall;
closeall;
symszn
xz=(1-(2*z^-1))/((1-(0.2*z^-1))*(1+(0.6*z^-1)))
pretty(xz)
xn=iztrans(xz)
pretty(xn)

xz =

(2/z - 1)/((1/(5*z) - 1)*(3/(5*z) + 1))

2
--1
z
-----------------------
/ 1 \/ 3 \
| --- - 1 | | --- + 1 |
\5z /\5z /

xn =

(13*(-3/5)^n)/4 - (9*(1/5)^n)/4

nn
13 (-3/5) 9 (1/5)
---------- - --------
4 4
Method 2: >> a=[1 -2];
>> b=[1 0.4 -0.12];
>> [h,n]=impz(a,b)

h=

1.0000
-2.4000
1.0800
-0.7200
0.4176
-0.2534
0.1515
-0.0910
0.0546
-0.0328
0.0197
-0.0118
0.0071
-0.0042
0.0025
-0.0015
0.0009
-0.0006
0.0003

n=

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

>> stem(n,h)

1.5

0.5

-0.5

-1

-1.5

-2

-2.5
0 2 4 6 8 10 12 14 16 18
Task-3:
Determine the Inverse z-transform of the following sequences, using partial
fraction expansion method.

x(z) = __1 – z-1 – 4z-2 + 4z-3_______


1 – 2.75z-1 + 1.625z-2 – 0.25z-3
x(z) = __z3 – z2– 4z1+ 4
z3 – 2.75z2+ 1.625z1– 0.25
CODE:

clc
clearall;
closeall;
a=[4,-4,-1,1];
b=[-0.25,1.65,-2,75,1];
[R,P,K]=residuez(a,b)

RESULT:

R=

-8.5366
-3.7385 + 1.8498i
-3.7385 - 1.8498i
0.0135

P=

9.2478
-1.3173 + 5.5422i
-1.3173 - 5.5422i
-0.0133

K=

[]

Method 2: >> a=[1 -1 -4 4];


>> b=[1 -2.75 1.625 -0.25];
>> [h,n]=impz(a,b)

h=
1.0000
1.7500
-0.8125
-0.8281
-0.5195
-0.2861
-0.1497
-0.0765
-0.0387
-0.0194
-0.0097
-0.0049
-0.0024
-0.0012
-0.0006
-0.0003
-0.0002
-0.0001
-0.0000

n=

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

>> stem(n,h)
2

1.5

0.5

-0.5

-1
0 2 4 6 8 10 12 14 16 18

Task-4:
A digital filter is described by the difference equation,
Y(n) = x(n) + x(n-1) + 0.9y(n-1) – 0.81y(n-2)
Using the freqz function, plot the magnitude and phase of the frequency response
Of the filter.

CODE:
a=[1,1];
b=[1,-0.9,0.81];
w=[0:1:500]*pi/500;
H=freqz(a,b,w);
megH=abs(H);
phaH=angle(H)*180/pi;
subplot(2,1,1);
plot(w/pi,megH),grid 'on';
title('Magnitude Response');
xlabel('frequency in pi units');
ylabel('?H?');
subplot(2,1,2);
plot(w/pi,phaH),grid 'on';
title('Phase Response');
xlabel('frequency in pi units');
ylabel('Degrees');

GRAPH:

Magnitude Response
15

10
?H?

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
frequency in pi units
Phase Response
50

0
Degrees

-50

-100

-150
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
frequency in pi units

You might also like