Lab 2
Lab 2
Lab 2
1. 𝑋1 (𝑧) = (1 − 2𝑧 −1 + 3𝑧 −2 − 4𝑧 −3 )(4 + 3𝑧 −1 − 2𝑧 −2 + 𝑧 −3 )
Codes:
x1=[1 -2 3 -4];
x2=[4 3 -2 1];
n1=[0:3];
[X1, N1]= conv_m(x1, n1, x2, n1)
Therefore:
𝑋1 (𝑧) = 4 − 5𝑧 −1 + 4𝑧 −2 − 2𝑧 −3 − 20𝑧 −4 + 11𝑧 −5 − 4𝑧 −6
2. 𝑋2 (𝑧) = (𝑧 2 − 2𝑧 + 3 + 2𝑧 −1 + 𝑧 −2 )(𝑧 3 − 𝑧 −3 )
Codes:
x3=[1 -2 3 2 -2];
n3=[-2:2];
x4=[1 0 0 0 0 0 -1];
n4=[-3:3];
[X2, N2]= conv_m(x3, n3, x4, n4)
Therefore:
𝑋2 (𝑧) = 𝑧 5 − 2𝑧 4 + 3𝑧 3 + 2𝑧 4 − 2𝑧 − 𝑧 −1 + 2𝑧 −2 − 3𝑧 −3 − 2𝑧 −4 + 2𝑧 −5
3. 𝑋3 (𝑧) = (1 + 𝑧 −1 + 𝑧 −2 )3
Codes:
x5=[1 1 1];
x6=[1 1 1];
x7=[1 1 1];
n5=[0:2];
[Y33 N33]= conv_m(x5, n5, x6, n5);
[X3 N3]=conv_m(x7, n5, Y33, N33)
Therefore:
𝑋3 (𝑧) = 1 + 3𝑧 −1 + 6𝑧 −2 + 7𝑧 −3 + 6𝑧 −4 + 3𝑧 −5 + 𝑧 −6
Therefore:
𝑋4 (𝑧) = 4𝑧 5 − 𝑧 4 + 11𝑧 3 + 11𝑧 2 + 16𝑧 + 11 − 43𝑧 −1 − 101𝑧 −2 − 250𝑧 −3 − 252𝑧 −4 − 184𝑧 −5
− 18𝑧 −6 + 94𝑧 −7 + 133𝑧 −8 + 247𝑧 −9 + 235𝑧 −10 + 176𝑧 −11 + 7𝑧 −12 − 55𝑧 −13
− 31𝑧 −14 − 8𝑧 −15 + 6𝑧 −16 − 8𝑧 −17
5. 𝑋5 (𝑧) = (𝑧 −1 − 3𝑧 −3 + 2𝑧 −5 + 5𝑧 −7 − 𝑧 −9 )(𝑧 + 3𝑧 2 + 2𝑧 3 + 4𝑧 4 )
Codes:
x8=[0 1 0 -3 0 2 0 5 0 -1];
x9=[4 2 3 1 0];
n8=[0:9];
n9=[-4:0];
[X5 N5]=conv_m(x8, n8, x9, n9)
Therefore:
𝑋5 (𝑧) = 4𝑧 3 + 2𝑧 2 − 9𝑧 − 5 − 𝑧 −1 + 𝑧 −2 + 26𝑧 −3 + 12𝑧 −4 + 11𝑧 −5 + 3𝑧 −6 − 3𝑧 −7 − 𝑧 −8
For the linear time-invariant systems described by the following systems functions, determine the impulse
response, difference equation representation, the pole-zero plot, the output 𝑦[𝑛] if the input is 𝑥[𝑛] =
𝜋𝑛
5𝑐𝑜𝑠 ( ) 𝑢[𝑛] and plot 100 samples of the output.
4
𝑧+1
6. 𝐻(𝑧) = 𝑧−0.5, causal system
1 + 𝑧 −1
𝐻(𝑧) =
1 − 0.5𝑧 −1
b1 = [1,1];
a1 = [1,-0.5];
[R,p,k] = residuez(b1,a1)
figure (1)
[z,p,l] = zplane(b1,a1);
n=[0:99];%100 samples
x=5.*cos(pi.*n/4).*(stepseq(0,0,99));
s=filter(b1,a1,x);
figure (2)
stem(n,s);%plot of the output
3
𝐻(𝑧) = −2 + 1−0.5𝑧−1
Impulse Response: ℎ(𝑛) = −2𝛿(𝑛) + 3(0.5)𝑛 𝑢(𝑛)
Difference Equation Representation: 𝑦(𝑛) = 𝑥(𝑛) + 𝑥(𝑛 − 1) + 0.5𝑦(𝑛 − 1)
Pole-zero plot:
Output y[n]: :
1+𝑧 −1 +𝑧 −2
7. 𝐻(𝑧) = , stable system
1+0.5𝑧 −1 −0.25𝑧 −2
b2 = [1,1,1];
a2 = [1,0.5,-0.25];
[R,p,k] = residuez(b2,a2)
figure (1)
[z,p,l] = zplane(b2,a2);
n=[0:99];%100 samples
x=5.*cos(pi.*n/4).*(stepseq(0,0,99));
s=filter(b2,a2,x);
figure (2)
stem(n,s);%plot of the output
0.9348 4.0652
𝐻(𝑧) = −4 + +
1+0.809𝑧 −1 1−0.309𝑧 −1
Impulse Response: ℎ(𝑛) = −4𝛿(𝑛) + 0.9348(−0.8090)𝑛 𝑢(𝑛) + 4.0652(0.3090)𝑛 𝑢(𝑛)
Difference Equation Representation: 𝑦(𝑛) = 𝑥(𝑛) + 𝑥(𝑛 − 1) + 𝑥(𝑛 − 2) − 0.5𝑦(𝑛 − 1) +
0.25𝑦(𝑛 − 2)
Pole-zero plot:
Output y[n]:
𝑧 2 −1
8. 𝐻(𝑧) = (𝑧−3)−2, anti-causal system
1−𝑧 −2
𝐻(𝑧) = 1−6𝑧−1 +9𝑧−2 ,
b3 = [1,0,-1];
a3 = [1,-6,9];
[R,p,k] = residuez(b3,a3)
figure (1)
[z,p,l] = zplane(b3,a3);
n=[0:99];%100 samples
x=5.*cos(pi.*n/4).*(stepseq(0,0,99));
s=filter(b3,a3,x);
figure (2)
stem(n,s);%plot of the output
0.2222 0.8889𝑧 −1
: 𝐻(𝑧) = −0.1111 + + (1−3𝑧−1 )2
1−3𝑧 −1
Impulse Response: ℎ(𝑛) = −0.1111𝛿(𝑛) − 0.2222(3)𝑛 𝑢(−𝑛 − 1) − 0.8889𝑛(3)𝑛+1 𝑢(−𝑛 − 1)
Difference Equation Representation: 𝑦(𝑛) = 𝑥(𝑛) − 𝑥(𝑛 − 2) + 6𝑦(𝑛 − 1) − 9𝑦(𝑛 − 2)
Pole-zero plot:
Output y[n]:
𝑧 1−0.5𝑧 −1
9. 𝐻(𝑧) = 𝑧−0.25 + 1+2𝑧−1 , stable system
2 + 1.25𝑧 −1 + 0.125𝑧 −2
𝐻(𝑧) =
1 + 1.75𝑧 −1 − 0.5𝑧 −2
b4 = [2,1.25,0.125];
a4 = [1,1.75,-0.5];
[R,p,k] = residuez(b4,a4)
figure (1)
[z,p,l] = zplane(b4,a4);
n=[0:99];%100 samples
x=5.*cos(pi.*n/4).*(stepseq(0,0,99));
s=filter(b4,a4,x);
figure (2)
stem(n,s);%plot of the output
1.25 1
𝐻(𝑧) = −0.25 + 1+2𝑧−1 + 1−0.25𝑧−1
Impulse Response: ℎ(𝑛) = −0.25𝛿(𝑛) − 1.25(2)𝑛 𝑢(−𝑛 − 1) + (0.25)𝑛 𝑢(𝑛)
Difference Equation Representation: 𝑦(𝑛) = 2𝑥(𝑛) + 1.25𝑥(𝑛 − 1) + 0.125𝑥(𝑛 − 2) −
1.75𝑦(𝑛 − 1) + 0.5𝑦(𝑛 − 2)
Pole-zero plot:
Output y[n]:
10. 𝐻(𝑧) = (1 + 𝑧 −1 + 𝑧 −2 )2
𝐻(𝑧) = 1 + 2𝑧 −1 + 3𝑧 −2 + 2𝑧 −3 + 𝑧 −4
x1=[1 2 3 2 1];
x2=[1];
n1=[0:4];
n2=[0];
[H, N1]= conv_m(x1, n1, x2, n2)
figure (1)
[z,p,l] = zplane(x1,x2);
n=[0:99];%100 samples
x=5.*cos(pi.*n/4).*(stepseq(0,0,99));
s=filter(x1,x2,x);
figure (2)
stem(n,s);%plot of the output
𝐻(𝑧) = 1 + 2𝑧 −1 + 3𝑧 −2 + 2𝑧 −3 + 𝑧 −4
Impulse Response: ℎ(𝑛) = {1 2 3 2 1} = 𝛿(𝑛) + 2𝛿(𝑛 − 1) + 3𝛿(𝑛 − 2) + 2𝛿(𝑛 − 3) + 𝛿(𝑛 − 4)
Difference Equation Representation: 𝑦(𝑛) = 𝑥(𝑛) + 2𝑥(𝑛 − 1) + 3𝑥(𝑛 − 2) + 2𝑥(𝑛 − 3) + 𝑥(𝑛 − 4)
Pole-zero plot:
Output y[n]:
For the following linear, causal and time-invariant systems described by the difference equations,
determine the impulse response representation, the system function, the pole-zero plot, the output y[n] if
the input is 𝑥(𝑛) = 4(0.2)𝑛 𝑢[𝑛] and plot 200 samples of the output.
𝑥[𝑛]+2𝑥[𝑛−1]+𝑥[𝑛−3]
11. 𝑦[𝑛] =
4
1+2𝑧 −1 +𝑧 −3
System Function: 𝐻(𝑧) =
4
1
Impulse Response: ℎ(𝑛) = [𝛿(𝑛) + 2𝛿(𝑛 − 1) + 𝛿(𝑛 − 3)]
4
x1=[1 2 0 1];
x2=[4];
figure (1)
[z,p,l] = zplane(x1,x2);
n=[0:199];%100 samples
x=5.*(0.2.^n).*(stepseq(0,0,199));
s=filter(x1,x2,x);
figure (2)
stem(n,s);%plot of the output
Pole-zero plot:
Output y[n]:
0.2764 0.7236
𝐻(𝑧) = 1+0.809𝑧−1 + 1−0.309𝑧−1
Impulse Response: ℎ(𝑛) = 0.2764(−0.809)𝑛 𝑢(𝑛) + 0.7236(0.309)𝑛 𝑢(𝑛)
Pole-zero plot:
Output y[n]:
Pole-zero plot:
Output y[n]:
0.2187 1.5536
𝐻(𝑧) = −2.2222 + +
1−0.9𝑧 −1 1+0.5𝑧 −1
Impulse Response: ℎ(𝑛) = −0.22222𝛿(𝑛) + 0.2187(0.9)𝑛 𝑢(𝑛) + 1.5536(−0.5)𝑛 𝑢(𝑛)
Pole-zero plot:
Output y[n]:
Impulse Response:
Pole-zero plot:
Output y[n]:
16-20. Decompose the responses of items 11-15 into three different ways.
Total response:
a. Homogenous part:
b. Particular part:
c. Transient part:
Total response:
Homogenous part:
Particular part:
Transient part:
Homogenous part:
Particular part:
Transient part:
Steady state response:
Homogeneous part:
Particular part:
Transient part:
4 4
20. y[n]= 0.8
m 0
m
x[n m] 0.9l y[n 1]
l 1
Total response:
Homogeneous part:
Particular part:
Transient part:
0.45 + 0.4𝑧 −1 − 𝑧 −2 +
𝑌 + (𝑧) = 𝑋
1 − 0.4𝑧 −1 − 0.45𝑧 −2
0.4𝑦[−1] + 0.45𝑦[−2] + 0.45𝑦[−1]𝑧 −1 + 0.4𝑥[−1] − 𝑥[−2] − 𝑥[−1]𝑧 −1
+
1 − 0.4𝑧 −1 − 0.45𝑧 −2
1 𝑛
𝑥[𝑛] = [2 + ( ) ] 𝑢[𝑛]
2
2 1
𝑥[𝑛] = −1
+
1−𝑧 1 − 0.5𝑧 −1
−4.0464 2.1964
𝑌𝑧𝑖+ = +
1−0.9𝑧 −1 1+0.5𝑧 −1
𝑦𝑧𝑖 (𝑛) = −4.0464(0.9)𝑛 𝑢(𝑛) + 2.1964(−0.5)𝑛 𝑢(𝑛)
Zero-state response:
+ (𝑧)
1.35 + 0.3𝑧 −1 − 3.8𝑧 −2 + 2𝑧 −3
𝑌 =
1 − 1.9𝑧 −1 + 0.65𝑧 −2 + 0. 475𝑧 −3 − 0. 225𝑧 −4
b2 = [1.35,0.3,-3.8,2];
a2 = [1,-1.9,0.65,0.475,-0.225];
[R2,p2,k2] = residuez(b2,a2)
+ (𝑧)
1.35 + 0.3𝑧 −1 − 3.8𝑧 −2 + 2𝑧 −3 −1.2 + 3𝑧 −1
𝑌 = +
(1 − 0.4𝑧 −1 − 0.45𝑧 −2 )(1 − 𝑧 −1 )(1 − 0.5𝑧 −1 ) 1 − 0.4𝑧 −1 − 0.45𝑧 −2
+ (𝑧)
0.12 + 5.2𝑧 − 6.1𝑧 + 1.5𝑧 −3
−1 −2
𝑌 =
1 − 1.9𝑧 −1 + 0.65𝑧 −2 + 0. 475𝑧 −3 − 0. 225𝑧 −4
b3 = [0.12,5.2,-6.1,1.5];
a3 = [1,-1.9,0.65,0.475,-0.225];
[R3,p3,k3] = residuez(b3,a3)
9.6 5.5264 2.7786 1.175
𝑌 + (𝑧) = − − −
1−𝑧 −1 1−0.9𝑧 −1 1+0.5𝑧 −1 1−0.5𝑧 −1
+ (𝑛)
𝑦 = 9.6 − 5.5264(0.9) 𝑢(𝑛) − 2.7786(−0.5)𝑛 𝑢(𝑛) − 1.175(0.5)𝑛 𝑢(𝑛)
𝑛
Transient Response: 𝑦𝑡𝑟 (𝑛) = −5.5264(0.9)𝑛 𝑢(𝑛) − 2.7786(−0.5)𝑛 𝑢(𝑛) − 1.175(0.5)𝑛 𝑢(𝑛)
Steady State Response: 𝑦𝑠𝑠 (𝑛) = 9.6
1 𝑛
Complementary Solution: 𝑦𝑐 (𝑛) = 2 + (2)
Particular Solution: 𝑦𝑝 (𝑛) = 𝑐1 (0.9)𝑛 + 𝑐2 (−0.5)𝑛
Zero-input response:
+ −1.2 + 3𝑧 −1
𝑌𝑧𝑖 =
1 − 0.4𝑧 −1 − 0.45𝑧 −2
b4 = [-1.2,3];
a4 = [1,-0.4,-0.45];
[R,p,k] = residuez(b4,a4)
1.3714 2.5714
𝑌𝑧𝑖+ = 1−0.9𝑧 −1 − 1+0.5𝑧−1
𝑦𝑧𝑖 (𝑛) = 1.3714(0.9)𝑛 𝑢(𝑛) − 2.5714(−0.5)𝑛 𝑢(𝑛)
Zero-state response:
+ (𝑧)
1.35 + 0.3𝑧 −1 − 3.8𝑧 −2 + 2𝑧 −3
𝑌 =
1 − 1.9𝑧 −1 + 0.65𝑧 −2 + 0. 475𝑧 −3 − 0. 225𝑧 −4
b2 = [1.35,0.3,-3.8,2];
a2 = [1,-1.9,0.65,0.475,-0.225];
[R2,p2,k2] = residuez(b2,a2)
−4.0464 2.1964
𝑌𝑧𝑖+ = +
1−0.9𝑧 −1 1+0.5𝑧 −1
𝑦𝑧𝑖 (𝑛) = −4.0464(0.9)𝑛 𝑢(𝑛) + 2.1964(−0.5)𝑛 𝑢(𝑛)
Zero-state response:
+ (𝑧)
1.35 + 0.3𝑧 −1 − 3.8𝑧 −2 + 2𝑧 −3
𝑌 =
1 − 1.9𝑧 −1 + 0.65𝑧 −2 + 0. 475𝑧 −3 − 0. 225𝑧 −4
b2 = [1.35,0.3,-3.8,2];
a2 = [1,-1.9,0.65,0.475,-0.225];
[R2,p2,k2] = residuez(b2,a2)
+ (𝑧)
1.35 + 0.3𝑧 −1 − 3.8𝑧 −2 + 2𝑧 −3 −1.85 − 4𝑧 −1
𝑌 = +
(1 − 0.4𝑧 −1 − 0.45𝑧 −2 )(1 − 𝑧 −1 )(1 − 0.5𝑧 −1 ) 1 − 0.4𝑧 −1 − 0.45𝑧 −2
−0.5 − 0.925𝑧 −1 − 8.875𝑧 −2 + 4𝑧 −3
𝑌 + (𝑧) =
1 − 1.9𝑧 −1 + 0.65𝑧 −2 + 0. 475𝑧 −3 − 0. 225𝑧 −4
b3 = [-0.5,-0.925,-8.875,4];
a3 = [1,-1.9,0.65,0.475,-0.225];
[R3,p3,k3] = residuez(b3,a3)
−84 91.0938 −3.9375 −3.6562
𝑌 + (𝑧) = 1−𝑧−1 + 1−0.9𝑧−1 + 1+0.5𝑧−1 + 1−0.5𝑧−1
𝑦 + (𝑛) = −84 + 91.0938(0.9)𝑛 𝑢(𝑛) − 3.9375(−0.5)𝑛 𝑢(𝑛) − 3.6562(0.5)𝑛 𝑢(𝑛)
Transient Response: 𝑦𝑡𝑟 (𝑛) = 91.0938(0.9)𝑛 𝑢(𝑛) − 3.9375(−0.5)𝑛 𝑢(𝑛) − 3.6562(0.5)𝑛 𝑢(𝑛)
Steady State Response: 𝑦𝑠𝑠 (𝑛) = −84
1 𝑛
Complementary Solution: 𝑦𝑐 (𝑛) = 2 + (2)
Particular Solution: 𝑦𝑝 (𝑛) = 𝑐1 (0.9)𝑛 + 𝑐2 (−0.5)𝑛
Zero-input response:
−1.85 − 4𝑧 −1
𝑌𝑧𝑖+ =
1 − 0.4𝑧 −1 − 0.45𝑧 −2
b4 = [-1.85,-4];
a4 = [1,-0.4,-0.45];
[R,p,k] = residuez(b4,a4)
−4.0464 2.1964
𝑌𝑧𝑖+ = +
1−0.9𝑧 −1 1+0.5𝑧 −1
𝑦𝑧𝑖 (𝑛) = −4.0464(0.9)𝑛 𝑢(𝑛) + 2.1964(−0.5)𝑛 𝑢(𝑛)
Zero-state response:
+ (𝑧)
1.35 + 0.3𝑧 −1 − 3.8𝑧 −2 + 2𝑧 −3
𝑌 =
1 − 1.9𝑧 −1 + 0.65𝑧 −2 + 0. 475𝑧 −3 − 0. 225𝑧 −4
b2 = [1.35,0.3,-3.8,2];
a2 = [1,-1.9,0.65,0.475,-0.225];
[R2,p2,k2] = residuez(b2,a2)
+ (𝑧)
1.35 + 0.3𝑧 −1 − 3.8𝑧 −2 + 2𝑧 −3 −1.85 − 4𝑧 −1
𝑌 = +
(1 − 0.4𝑧 −1 − 0.45𝑧 −2 )(1 − 𝑧 −1 )(1 − 0.5𝑧 −1 ) 1 − 0.4𝑧 −1 − 0.45𝑧 −2
−0.5 − 0.925𝑧 −1 − 8.875𝑧 −2 + 4𝑧 −3
𝑌 + (𝑧) =
1 − 1.9𝑧 −1 + 0.65𝑧 −2 + 0. 475𝑧 −3 − 0. 225𝑧 −4
b3 = [-0.5,-0.925,-8.875,4];
a3 = [1,-1.9,0.65,0.475,-0.225];
[R3,p3,k3] = residuez(b3,a3)
−84 91.0938 −3.9375 −3.6562
𝑌 + (𝑧) = 1−𝑧−1 + 1−0.9𝑧−1 + 1+0.5𝑧−1 + 1−0.5𝑧−1
𝑦 + (𝑛) = −84 + 91.0938(0.9)𝑛 𝑢(𝑛) − 3.9375(−0.5)𝑛 𝑢(𝑛) − 3.6562(0.5)𝑛 𝑢(𝑛)
Transient Response: 𝑦𝑡𝑟 (𝑛) = 91.0938(0.9)𝑛 𝑢(𝑛) − 3.9375(−0.5)𝑛 𝑢(𝑛) − 3.6562(0.5)𝑛 𝑢(𝑛)
Steady State Response: 𝑦𝑠𝑠 (𝑛) = −84
1 𝑛
Complementary Solution: 𝑦𝑐 (𝑛) = 2 + (2)
Particular Solution: 𝑦𝑝 (𝑛) = 𝑐1 (0.9)𝑛 + 𝑐2 (−0.5)𝑛
Zero-input response:
−1 − 𝑧 −1
𝑌𝑧𝑖+ =
1 − 0.4𝑧 −1 − 0.45𝑧 −2
b4 = [-1.85,-4];
a4 = [1,-0.4,-0.45];
[R,p,k] = residuez(b4,a4)
−4.0464 2.1964
𝑌𝑧𝑖+ = +
1−0.9𝑧 −1 1+0.5𝑧 −1
𝑦𝑧𝑖 (𝑛) = −4.0464(0.9)𝑛 𝑢(𝑛) + 2.1964(−0.5)𝑛 𝑢(𝑛)
Zero-state response:
+ (𝑧)
1.35 + 0.3𝑧 −1 − 3.8𝑧 −2 + 2𝑧 −3
𝑌 =
1 − 1.9𝑧 −1 + 0.65𝑧 −2 + 0. 475𝑧 −3 − 0. 225𝑧 −4
b2 = [1.35,0.3,-3.8,2];
a2 = [1,-1.9,0.65,0.475,-0.225];
[R2,p2,k2] = residuez(b2,a2)
𝑥[𝑛]+2𝑥[𝑛−1]+𝑥[𝑛−3]
26. 𝑦[𝑛] = 4
x1=[1 2 0 1];
x2=[4];
z = roots(x2);
magz = abs(z)
Since the magnitudes of the roots are less than one, the system is stable.
Since the magnitudes of the roots are less than one, the system is stable.
Since the magnitudes of the roots are less than one, the system is stable.