Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

PROGRAM 1

clc;
clear all;
close all;
a = input('Enter the sequence, x(n): ');
syms z;
r = poly2sym(a,z);
disp('The z transform of the given sequence is, X(z): ');
disp(r);

OUTPUT 1
Enter the sequence, x(n): [1 2 3 4 5]
The z transform of the given sequence is, X(z):
z^4 + 2*z^3 + 3*z^2 + 4*z + 5

PROGRAM 2

clc;
clear all;
close all;
a =[3 -2 0 0 1 4 5 7];
disp('The given sequence is, x(n): ');
disp(a);
syms z;
r = poly2sym(a,z);
p = r*(z^-4);
disp('The z transform is, X(z): ');
disp(p);

OUTPUT 2
The given sequence is, x(n):
3 -2

The z transform is, X(z):


(3*z^7 - 2*z^6 + z^3 + 4*z^2 + 5*z + 7)/z^4

PROGRAM 3
clc;
clear all;
close all;
disp('The given polynomial is: 2[(z^-4)-(z^-3)*(1-exp(-a)(z^-1))]');
disp('
------------------------------------');
disp('
(1-exp(-a)(z^-1))');
disp(' ');
a=input('Please enter a value for the variable "a": ');
disp(' ');
syms z;
N = 2*((1+exp(-a))-z);
D = (z^3)*(z-exp(-a));
n = sym2poly(N);
d = sym2poly(D);
z = roots(n);
p = roots(d);
zplane(z,p);
grid on;
disp('The zeros are at, z= ');
disp(z);
disp('The poles are at, z= ');
disp(p);

OUTPUT 3
The given polynomial is: 2[(z^-4)-(z^-3)*(1-exp(-a)(z^-1))]
-----------------------------------(1-exp(-a)(z^-1))
Please enter a value for the variable "a": 0.4

The zeros are at, z=


1.6703
The poles are at, z=
0
0
0
0.6703

PLOT

PROGRAM 4
clc;
clear all;
close all;
disp('The given function, X(z)=
1');
disp('
------------------------');
disp('
(1-1.5(z^-1)+0.5(z^-2))');
disp(' ');
a=input('Please enter the coefficients of numerator: ');
b=input('Please enter the coefficients of denominator: ');
n=input('Please enter the number of terms in quotient: ');
for (i=length(a)+1:1:n)
a(i)=0;
end;
for(i=1:1:n)
Quotient(i)=a(1)/b(1);
for(k=2:1:length(b))
a(k)=a(k)-b(k)*(Quotient(i));
end;
for(j=1:1:length(a)-1)
a(j)=a(j+1);
end;
end;
disp(' ');
disp('The inverse z transformed sequence is: ');
disp(Quotient);

OUTPUT 4
The given function, X(z)=

1
-----------------------(1-1.5(z^-1)+0.5(z^-2))

Please enter the coefficients of numerator: [1]


Please enter the coefficients of denominator: [1 -1.5 0.5]
Please enter the number of terms in quotient: 4
The inverse z transformed sequence is:
1.0000 1.5000 1.7500 1.8750

PROGRAM 5
clc;
clear all;
close all;
disp('The given function, X(z)= 1+3(z^-1)+11/6(z^-2)+1/3(z^-3)');
disp('
-------------------------------');
disp('
(1+5/6(z^-1)+1/6(z^-2))');
disp(' ');
a=input('Please enter the coefficients of numerator: ');
b=input('Please enter the coefficients of denominator: ');
syms z;
[r,p,k]=residue(a,b);
c=length(k);
for(i=1:1:c)
t(i)=k(i)*(z^(-i+1));
end;
syms U
U =0;
d=length(r);
for(i=1:1:d)
u(i)=r(i)/(z-p(i));
U=U+iztrans(u(i));
end;
T=iztrans(t);
e=0;
for(i=1:1:length(T))
e=e+T(i);
end;
for(i=1:1:length(U))
e=e+U;
end;
disp(' ');
disp('The residues are at: ');
disp(r);
disp('The poles are at: ');
disp(p);
disp('The direct terms are: ');
disp(k);
disp('The inverse z transformed sequence is: ');
disp(e);

OUTPUT 5

The given function, X(z)= 1+3(z^-1)+11/6(z^-2)+1/3(z^-3)


------------------------------(1+5/6(z^-1)+1/6(z^-2))
Please enter the coefficients of numerator: [1 3 11/6 1/3]
Please enter the coefficients of denominator: [1 5/6 1/6]
The residues are at:
-0.2500
0.1111
The poles are at:
-0.5000
-0.3333
The direct terms are:
1.0000 2.1667
The inverse z transformed sequence is:
(13*kroneckerDelta(n - 1, 0))/6 + (-1/2)^n/2 - (-1/3)^n/3 + (5*kroneckerDelta(n, 0))/6

PROGRAM 7
clc;
clear all;
close all;
syms z;
a=z^10;
b=(z-0.5)*((z-1.5)^(10))*((z+1.5)^(2))*(z+2.5)*(z+3.5);
c=a/b;
A=sym2poly(a);
B=sym2poly(b);
Z=roots(A);
P=roots(B);
zplane(Z,P);
d=min(P);
if(d<1)
if(length(P)>1)
for(i=1:1:length(P))
if(P(i)>1||P(i)< -1)
p(i)=P(i);
end;
end;
d
f=min(p);
e=0;
else
e=-1;
end;
else
e=1;
end;
if(e==1)
disp(['The ROC is the region inside the circle of radius : ',num2str(d)]);
elseif(e==-1)
disp(['The ROC is the region outside the circle of radius : ',num2str(d)]);
elseif(e==0)
disp(['The ROC is the region inside the circles of radii : ',num2str(d)]);
disp(['and ',num2str(real(f))]);
end;
xn=iztrans(c)
%polyval(xn, -8)

OUTPUT 7
d=
0.5000
The ROC is the region inside the circles of radii : 0.5 and 1.4498
xn =
(9005352289*(3/2)^n*binomial(n - 1, 3))/737280000000 (19331799781*(3/2)^n*binomial(n - 1, 2))/9830400000000 +
(1360727153*(3/2)^n*binomial(n - 1, 4))/18432000000 + (7950009*(3/2)^n*binomial(n
- 1, 5))/51200000 + (1992337*(3/2)^n*binomial(n - 1, 6))/11520000 +
(31649*(3/2)^n*binomial(n - 1, 7))/288000 + (91*(3/2)^n*binomial(n - 1, 8))/2400 +
((3/2)^n*binomial(n - 1, 9))/180 + (1/2)^n/24576 - (13*(-3/2)^n)/18432 +
(5910537885233*(3/2)^n)/47185920000000000 + (1953125*(-5/2)^n)/1610612736 (40353607*(-7/2)^n)/80000000000 - ((-3/2)^n*(n - 1))/9216 +
(72912370241*(3/2)^n*(n - 1))/1179648000000000

PLOT

You might also like