Professional Documents
Culture Documents
Maulina Putri Lestari - M0220052 - Tugas 1
Maulina Putri Lestari - M0220052 - Tugas 1
TUGAS
Disusun Oleh:
Maulina Putri Lestari (M0220052)
Script matlab
% P0401a.m
clc; close all;
b1 = [0 2 3]; a1 = [1]; [delta,n] = impseq(0,0,4);
xb1 = filter(b1,a1,delta); xb1 = fliplr(xb1); n1 = -fliplr(n);
b2 = [1 -2 -3]; a2 = [1]; xb2 = filter(b2,a2,delta); n2 = n;
[xa1,na1] = sigadd(xb1,n1,xb2,n2); xa2 = [0 0 3 2 1 -2 -3 0 0];
error = max(abs(xa1-xa2))
error =
0
2. 𝓍 (𝑛) = (0.8)𝑛 𝑢(𝑛 − 2): Then
∞ ∞
𝑛 −𝑛 2 −2
0.64𝓏 −2
𝑋 (𝓏) = ∑(0.8) 𝓏 = (0.8) 𝓏 ∑(0.8)𝑛 𝓏 −1 = ; |𝓏| < 0.8
1 − 0.8𝓏 −1
𝑛=2 𝑛=0
Script matlab
% P0401b.m
clc; close all;
b = [0 0 0.64]; a = [1 -0.8]; [delta,n] = impseq(0,0,10);
xb1 = filter(b,a,delta);
[u,n] = stepseq(2,0,10); xb2 = ((0.8).^n).*u;
error = max(abs(xb1-xb2))
error =
1.1102e-016
1 1
𝑋(𝓏) = 𝒵 [(0.5)𝑛 𝑢(𝑛)] + 𝒵[(−0.8)𝑛 𝑢(𝑛)] = −1
+ ; {|𝓏| > 0.5} ∩ {|𝓏| > 0.8}
1 − 0.5𝓏 1 + 0.8𝓏 −1
2 + 0.3𝓏 −1
= ; |𝓏| > 0.8
1 + 0.3𝓏 −1 − 0.4𝓏 −2
Script matlab
% P0401c.m
clc; close all;
b = [ 2 0.3]; a = [1 0.3 -0.4]; [delta,n] = impseq(0,0,7);
xb1 = filter(b,a,delta);
[u,n] = stepseq(0,0,7); xb2 = (((0.5).^n).*u)+(((-0.8).^n).*u);
error = max(abs(xb1-xb2))
error =
1.1102e-016
∞ 0 ∞
𝑛 −1 𝑛 −𝑛
𝑋(𝓏) = ∑ 2 cos(0.4𝜋𝑛)𝑢(−𝑛)𝓏 = ∑ 2 cos(0.4𝜋𝑛)𝓏 = ∑ 2−𝑛 cos(0.4𝜋𝑛)𝓏 𝑛
𝑛=−∞ 𝑛=−∞ 𝑛=0
∞ ∞ ∞
−𝑛
𝑒𝑗 0.4𝜋𝑛 + 𝑒 −𝑗0.4𝜋𝑛 1 1
= ∑2 ( ) 𝓏 𝑛 = ∑(2−1 𝑒 𝑗0.4𝜋𝓏 )𝑛 + ∑(2−1 𝑒 𝑗0.4𝜋𝓏. )𝑛
2 2 2
𝑛=0 𝑛=0 𝑛=0
1 1 1 1
= ( 1 )+ ( 1 ) ; |𝓏| < 2
2 1 − 2𝑒 −𝑗0.4𝜋𝓏 2 1 − 2 𝑒 −𝑗0.4𝜋𝓏.
Hence
𝑑 1 1
X(𝓏) = 𝒵[𝑛3𝑛 𝑢(𝑛)] + 𝒵[3𝑛 𝑢(𝑛)] = −𝓏 𝑑𝓏 (1−3𝓏 −1 ) + 1−3𝓏 −1 ; |𝓏| > 3
3𝓏 −1 1 1 − 3𝓏 −1
= + = ; |𝓏| > 3
1 − 6𝓏 −1 + 9𝓏 −2 1 − 3𝓏 −1 1 − 9𝓏 −1 + 27𝓏 −2 − 27𝓏 −3
Script matlab
% P0401e.m
clc; close all;
b = [1 -3]; a = [1 -9 27 -27]; [delta,n1] = impseq(0,0,7);
xb1 = filter(b,a,delta);
[u,n2] = stepseq(0,0,7); xb2 = ((n2+1).*(3.^n2)).*u;
error = max(abs(xb1-xb2))
error =
0
Problem 4.23
Solve the following difference equation for y(n) using the one-sided z-transform approach.
y(n)=0.81y(n − 2) + x(n) − x(n − 1), n ≥ 0; y(−1)=2, y(−2)=2
x(n) = (0.7)nu(n + 1)
Generate the first 20 samples of y(n) using MATLAB, and compare them with your answer
Answer
Difference equation solution using the one – sided 𝓏- transfrom approach.
𝑦(𝑛) = 0.8𝑦(𝑛 − 2) + 𝑥(𝑛) − 𝑥(𝑛 − 1), 𝑛 ≥ 0; 𝑦(−1) = 2, 𝑦(−2) = 2
𝑥(𝑛) = (0.7)𝑛 𝑢(𝑛 + 1)
Notice that
(0.7)−1 𝑛 = −1;
𝓍(𝑛) = (0.7)𝑛 𝑢 (𝑛 + 1) = {
(0.7)𝑛 𝑢(𝑛) 𝑛 ≥ 0,
After taking the one – sided 𝓏-transfrom of the above difference equation, we obtion
𝑌 + (𝓏) = 0.81[𝑦(−2) + 𝑦(−1)𝓏 −1 + 𝓏 −2 𝑌 + (𝓏)] + 𝑋 + (𝓏) − [𝑥(−1) + 𝓏 −1 𝑋 + (𝓏)]
Or
1
After substituting the initial conditions and 𝑋 + (𝓏) = 𝒵[0. 7𝑛 𝑢(𝑛)] = 1−0.81𝓏 −1′ we obtain
1 − 𝓏 −1 1 0.1914 + 1.62𝓏 −1
𝑌 + (𝓏) = ( ) ( ) +
1 − 0.81𝓏 −1 1 − 0.7𝓏 −1 1 − 0.81𝓏 −1