# Calculating tranfer function, poles, zeros and impulse response given input and outpul signals in matlab

I have been given an input and output signal.

input: x(n)=(0.3^n)*u(n) + (5^n)*u(-n-1)

output: y(n)=(3^n)*u(-n-1) - ((2^(n+2))/(3^n))*u(n).

or

x=(0.3.^n).*(n>=0) + (5.^n). *(n<=-1) --> in Matlab

y=(3.^n). * (n<=-1) - 4. * ((2/3).^n).*(n>=0) --> in Matlab

I am supposed to find the tranfer function, it's poles and zeros and impulse response using matlab . I searched a lot but I couldn't find a way to aproach it in matlab.

I managed to find a transfer polynomial solving this on paper and came up with a=[-5 39.16 -74,63 19], as numerator coefficients and b=[0 -4.7 17.23 -9.4], as denominator coefficients. It turns out, whatsoever, that matlab can't make a valid computation of the poles and zeros as well as the impulse resonspe of the system since "the first denominator filter coefficient must be non-zero".

Any idea on how can I solve this exclusively using matlab or how can I eliminate the first 0 (zero) denominator coefficient?

thank you.

The Z-transform of the transfer function is $$H(z) = Y(z)/X(z)$$: the ratio of output to input Z-transforms.
Matlab provides a ztrans() method for computing Z-transforms symbolically (I didn't know this existed until now).