Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

A.

1 f= an

MATLAB code
clc;
clear all;
close all;
syms a f n;
f=a^n;
ztrans(f)
Code output
-z/(a - z)

A.2 x1(z)= 2+3z-1+4z-2, x2(z)=3+4z-1+5z-2+6z-3


MATLAB code
clc;
clear all;
close all;
x1= [2 3 4];
x2=[3 4 5 6];
x3=conv(x1,x2)
Code output
X3 = 6 17 34 43 38 24
Verification:
x1(z) x2(z)= (2+3z-1+4z-2) (3+4z-1+5z-2+6z-3)
=6+8z-1+10z-2+12z-3+9z-1+12z-2+15z-3+18z-4+12z-2+16z-3+20z-4+24z-5
=6+17z-1+34z-2+43z-3+38z-4+24z-5

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)

Also using iztrans() function we have got the same x[n].


1+2.0 z−1
B.1 X(z)=
1+ 0.4 z−1−0.12 z−2

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)

Construction of system function: Y(z)=z-1Y(z)+X(z), => Y(z) (1-z-1)=X(z),

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:

plot of unit impulse response plot of unit step response


1 25

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

not stable system


3−4 z−1
c.5
1−3.5 z−1+ 1.5 z−2

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

2 z 4 +16 z 3 +44 z2 +56 z +32


C.6 4
3 z + 3 z 3−15 z 2 +18 z−12

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

+ 0.8660i, 0.5000 - 0.8660i

ROC: 1) for causal system: |z|>3.236,

2) for anticausal system :1.2361<|z|<3.236

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

-1 -0.5 0 0.5 1 1.5 2


Real Part

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

Verifying with Matlab:

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

-1 -0.5 0 0.5 1 1.5 2


Real Part

Here the zero at 2 cancels the pole at 2.

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

Verifying with Matlab code:

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

-1 -0.5 0 0.5 1 1.5 2


Real Part

Here the zero at .5 cancels the pole at .5

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.

You might also like