Dspexp 3
Dspexp 3
Dspexp 3
1 f= an
MATLAB code
clc;
clear all;
close all;
syms a f n;
f=a^n;
ztrans(f)
Code output
-z/(a - z)
z
B.1 X(z)= 2
3 z −4 z +1
MATLAB Code:
clc; clear all; close all;
b = [0 1];
a = [3 -4 1];
[R,p,C] = residuez(b,a)
Code Output:
R= 0.5 0.5
P= 1 0.333
Analysis:
0.5 0.5
X(z)= −1 -
1−z 1−0.333 z−1
Poles: 1, 0.333
1
x[n]= [0.5 -0.5( 3 )n] u(n)
MATLAB Code:
clc; clear all; close all;
a=[1 0.4 -0.12];
b=[1 2];
n=1:10;
y=impz(b,a,n);
stem(n,y ,title ('Impulse response of the function');
Code Output:
Impulse response of the function
2
-1
1 2 3 4 5 6 7 8 9 10
C.3 y(n)=y(n-1)+x(n)
1
=>H(z)=
1−z−1
MATLAB Code:
clc; clear all; close all;
num=[1];
den=[1 -1];
n=1:20;
h=impz(num,den,n);
s=stepz(num,den,n);
subplot(1,2,1), stem(n,h), title('plot of unit
impulse response');
subplot(1,2,2), stem(n,s), title('plot of unit step
response');
Code Output:
0.8 20
0.6 15
0.4 10
0.2 5
0 0
0 5 10 15 20 0 5 10 15 20
1 1
C.4 Y(n)= 2 y(n-1)+x(n)++ 3 x(n-1)
System function: Y(z)=0.5z-1Y(z)+X(z)+0.333z-1X(z),
=>Y(z)(1-0.5Z-1)=X(z)(1+0.333z-1)
1+ 0.333 z −1
=>H(Z)=
1−0.5 z−1
MATLAB Code:
clc; clear all; close all;
den=[1 -0.5];
num=[1 1/3];
n=-5:20;
h=impz(num,den,n);
subplot(1,2,1),stem(n,h), title ('plot of impulse
response');
subplot(1,2,2),zplane(num,den), title ('plot of
transfer function')
Code Output:
plot of impulse response plot of transfer function
1 2
0.8
1
Imaginary Part
0.6
0
0.4
-1
0.2
0 -2
-5 0 5 10 15 20 -1 0 1
Real Part
Comment 1) |z|>0.5 for causal and stable system, 2)|z|<0.5 for anti-causal and
MATLAB Code:
clc; clear all; close all;
den=[1 -3.5 1.5];
num=[3 -4];
zplane(num,den)
[r p c]=residuez(num,den)
Code Output:
1.5
1
Imaginary Part
0.5
-0.5
-1
-1.5
-1 0 1 2 3
Real Part
Comment: a) the system is causal for |z|>3, b)anticausal for 0.5<|z|<3 and c) non
causal for |z|<0.5. For the case of ‘b)’, the system is stable
MATLAB Code:
clc; clear all; close all;
den=[3 3 -15 18 -12];
num=[2 16 44 56 32];
zplane(num,den)
[r p c]=residuez(num,den)
Code Output:
1
Imaginary Part
-1
-2
-4 -3 -2 -1 0 1
Real Part
Comment: here the poles are : -3.2361 + 0.0000i, 1.2361 + 0.0000i, 0.5000
C.7
System Function:
Using z-transform:
5 1
Y ( z )= z−1 Y ( z )− z −2 Y ( z ) + X ( z )
6 6
5 1
[ ]
⇒ Y ( z ) 1− z−1 + z−2 = X ( z )
6 6
Y ( z) 1
∴ H ( z )= =
X (z) 5 1
1− z−1+ z−2
6 6
For the input x[n],
1
X ( z )=1− z −1
3
So the output is given by
1
1− z−1
3
Y ( z )=H ( z ) X ( z )=
5 1
1− z−1 + z−2
6 6
MATLAB Code:
clc;
clear all;
close all;
b = [1 -1/3];
a = [1 -5/6 1/6];
[R,p,C] = residuez(b,a)
y=impz(b,a,100);
stem(y);
Output:
R = 1.000, 0.0000
p = 0.5000, 0.3333
Thus,
1
Y ( z )=
1
1− z−1
2
Here, pole 1/3 of H(z) has been cancelled out by multiplication with X(z) as
multiplication with X(z) has created a zero at 1/3. This zero at 1/3 cancels the pole at
1/3.
y(n)
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0 10 20 30 40 50 60 70 80 90 100
C.8
clc;
clear all;
close all;
b = [1];
a = [1 -2.5 1];
zplane(b,a)
1
0.5
Imaginary Part 0
2
-0.5
-1
From the pole zero plot, we can see that the system is stable for 0.5<| z|< 2; while the system
is noncausal.
1
a) To make the system causal and stable, ROC would be |z|> . Thus, z=2 cannot be a
2
pole and the only pole remains at z=0.5 .So we cancel this pole by adding a zero at
z=2 Thus the system would be
z ( z−2)
2
z −2.5 z +1
clc;
clear all;
close all;
b = [1 -2];
a = [1 -2.5 1];
zplane(b,a)
1
0.5
Imaginary Part
0
-0.5
-1
b.
To make the system anticausal and stable, ROC would be |z|<2. Thus, z=0.5 cannot be a pole
and the only pole remains at z=2 . So we cancel this pole by adding a zero at z=.5 Thus the
system would be
z (z−.5)
2
z −2.5 z +1
clc;
clear all;
close all;
b = [1 -.5];
a = [1 -2.5 1];
zplane(b,a)
1
0.5
Imaginary Part
0
-0.5
-1
Exercise D:
clc;
close all;
clear all;
a = [1 -.5];
A(length(a)-1,:)=a;
A(:,1) = 1;
B(length(a)-1,:) = fliplr(A(length(a)-1,:));
K(length(a)-1) = A(length(a)-1,length(a));
for k = length(a)-2:-1:1
for j = length(a):-1:2
A(k,j) = (A(k+1,j)-K(k+1)*B(k+1,j))/(1-
K(k+1)^2);
end
K(k) = A(k,k+1);
B(k,1:(k+1)) = fliplr(A(k,1:(k+1)));
end
b = [1 1/3];
zplane(b,a)
if sum(abs(K)>=1)>0
display('Unstable')
else
display('Stable')
end
Output:
Stable
0.8
0.6
0.4
Imaginary Part
0.2
-0.2
-0.4
-0.6
-0.8
-1
-1 -0.5 0 0.5 1
Real Part
Here, the pole is inside the unit circle ..So the system is stable.