% Program 6_2
% Determination of the Rational z-Transform
% from its Poles and Zeros
% e.g zeros are [0.21 3.14 -0.3-i0.5 -0.3-i0.5]
%     poles are [-0.45 0.67 0.81+i0.72 0.81-i0.72]
%     Gain constant is 2.2
format long
% zr = input('Type in the zeros as a row vector = ');
% pr = input('Type in the poles  as a row vector = ');
zr = [0.21 3.14 -0.3-0.5i -0.3+0.5i];
pr = [-0.45 0.67 0.81+0.72i 0.81-0.72i];
% Transpose zero and pole row vectors
z = zr'; p = pr';
% k = input('Type in the gain constant = ');
k= 2.2;
[num, den] = zp2tf(z, p, k);
disp('Numerator polynomial coefficients'); disp(num);
disp('Denominator polynomial coefficients'); disp(den);