# Confusion regarding usage of MATLAB for Z domain?

How we can use MATLAB for z domain especially in scenarios where we have two different expressions of Z transform(one has negative powers of z and other has positive powers of z)

I have added a link and snapshot of that and relevant MATLAB code where i get different poles and zeros when i switch from z^-1 form to z form

So which form is correct and why we get this difference? My Updated Matlab code:

clc;clear;close all
%using negative power representation
num1=[2 3 4]
den1=[1 3 3 1]
[z1,p1,k1]=tf2zp(num1,den1)
zplane(z1,p1)
title('pole zero plot using negative power representation')
%using positive power representation
num2=[2 3 4 0]
den2=[1 3 3 1]
[z2,p2,k2]=tf2zp(num2,den2)
figure
zplane(z2,p2)
title('pole zero plot using positive power representation')


http://www.ece.northwestern.edu/local-apps/matlabhelp/toolbox/signal/basics27.html

• Try solve what is the difference between s-domain (continuous time) and z-domain (discrete time) function. Mar 22, 2023 at 17:06
• in wireless channels interference hits receivers, not only on the expected sampling time, but after (delayed) and before (in advance) to sampling times. If you model just attempting to supress late interference, you are not fencing off the 'clever' one that gets to receiver just before the signal of interest does. So this is one example of why filters include 'a posteriori' (late) as well as 'a priori' (in advance) taps. Apr 14, 2023 at 8:52

This answer has been updated to be consistent with the modified question. My earlier response remains further below to the question originally posted.

Transfer functions can be described using either positive powers or negative powers for the polynomials. Either can be used at the convenience of the user. It is more common for continuous time systems using $$s$$ for the variable in the Laplace Transform to be described with positive powers of $$s$$, while negative powers of $$z$$ are quite common for discrete-time systems using $$z$$ for the variable in the Z Transform. A big reason for this is the z transform of the unit sample delay is $$z^{-1}$$, so using negative power descriptions leads more readily to implementation block diagrams.

That said the OP is using the Matlab tf2zp function, and the help for this function states clearly that the polynomials are entered in positive powers in decreasing order (regardless if we use $$s$$ or $$z$$). So the OP's numerator polynomial given as [2,3, 4] would describe the polynomial as:

$$2z^2 + 3z + 4$$

The OP has then modified this polynomial by simply adding a zero to the end of it. This results in the following polynomial:

$$2z^3 + 3z^2 + 4z + 0$$.

The result is multiplying the original polynomial by $$z$$, which is identical to adding a zero at the origin, since $$z=0$$ is now a root of the numerator. This is consistent with the results provided in the graphic at the bottom of the question posted.

That said, the comment for the following is not correct:

%using negative power representation
num1=[2 3 4]
den1=[1 3 3 1]
[z1,p1,k1]=tf2zp(num1,den1)


The above uses positive power representation given it is using the 'tf2zp' function. This representation is describing the following polynomial if we assume the variable is $$z$$:

$$H_1(z) = \frac{2z^2+ 3z+4}{z^3+3z^2+3z+1}$$

The next lines are correct, it is positive power representation but for a different polynomial:

%using positive power representation
num2=[2 3 4 0]
den2=[1 3 3 1]
[z2,p2,k2]=tf2zp(num2,den2)


This representation is describing the following polynomial in comparison:

$$H_2(z) = zH_1(z) = \frac{2z^3+ 3z^2+4z}{z^3+3z^2+3z+1}$$

As described earlier we simply multiplied the original transfer function by $$z$$.

I don't know which transfer function the OP really wants, but let's assume the OP's intention is to describe the first polynomial with negative powers of $$z$$, namely the polynomial with numerator given as [2,3,4] and denominator given as [1,3,3,1] corresponds to the following transfer function:

$$H_3(z) = \frac{2+ 3z^{-1}+4z^{-2}}{1+3z^{-1}+3z^{-2}+z^{-3}}$$

Then we have the following two options:

Option 1: Use Matlab's alternate function tfzpk where the help states the polynomials are entered directly with negative powers, so:

tfzpk([2 3 4], [1 3 3 1])


Option 2: (When we don't have the luxury of a companion function that can take negative powers directly, namely we want a $$H_3(z)$$ that can be used with a function such as tfzp that only allows a positive power format. The details of this are given in my original answer below with the following result):

Convert $$H_3(z)$$ to be the same transfer function, described with positive powers of $$z$$ in the format required by the function:

$$H_3(z) = \frac{z^3}{z^3}\frac{2+ 3z^{-1}+4z^{-2}}{1+3z^{-1}+3z^{-2}+z^{-3}} = \frac{2z^3+3z^2+4z}{z^3+3z^2+3z+1}$$

This results in the following MATLAB command:

tf2zp([2 3 4 0], [1 3 3 1]


Both Option 1 and Option 2 should provide the identical result.

Answer to question as originally posted

The OP's intended transfer function written with negative power representation is given as:

$$H(z) = \frac{2+3 z^{-1}+ 4 z^{-2}}{1+3 z^{-1}+ 3 z^{-2} + z^{-3}}$$

The function the OP is using requires positive power representation. If we wanted instead $$H(z)$$ to be expressed with all positive powers of $$z$$, in lowest order, we can multiply numerator and denominator by $$z^3$$ resulting in:

$$H(z) = \bigg(\frac{z^3}{z^3}\bigg)\frac{2+3 z^{-1}+ 4 z^{-2}}{1+3 z^{-1}+ 3 z^{-2} + z^{-3}}$$

If we multiply this out we get:

$$H(z) = \frac{2z^3+3z^2+4z + 0}{z^3 +3z^2+3 z+ 1}$$

The OP has added a extra zero on both numerator and denominator polynomials instead of the numerator only as demonstrated above. What the OP has done does not achieve the result detailed above and changes the poles represented, as the OP has found, since the denominator order has increased. However a simple solution in this particular case is to just use the alternate MATLAB function 'tf2zpk' that uses negative powers of z directly: The MATLAB function used 'tf2zp' states in its help that it uses a positive power representation and recommends using another function 'tf2zpk' when a negative power representation is desired. MATLAB, Octave and Python functions used for signal processing and discrete time processing in the z-domain typically use polynomials expressed with negative powers. While MATLAB, Octave and Python functions used for control systems and continuous time processing typically used polynomials expressed with positive powers. This isn't a hard and fast rule, so best to refer to the help documentation for any function used to determine which convention is used.

• you mean it is just a matter of convention?and both forms(one with positive powers of z and other with negative powers of z) are equal and both can be used interchangbly?? May 19, 2023 at 13:18
• Why the two user names? May 19, 2023 at 13:33
• They are not interchangeable, one is the reverse of the other. The polynomial a+ bz+cz^2 is not the same as c + bz + az^2. You need to look at what the function expects and use it that way. Otherwise you are expecting one form and the function is expecting the other. May 19, 2023 at 13:34
• I have tried your suggested approach and used tf2zpk but still i am not able to see any difference between effect of tf2zp and tf2zpk . May 20, 2023 at 9:06
• In both cases, whether we use tf2zp or tf2zpk, pole zero plot of positive power representation and negative power representation are not same. In pole zero plot of positive power representation, we are also having a zero at origin May 20, 2023 at 9:08