I'm trying to plot the frequency response $H(z)$ of given zeros/poles using the following code in MATLAB:

z=[0.36545+0.88446i; 0.01-0.1057i;]
p=[-0.46016+0.87251i; -0.37649-0.94861i;]
[num, den]=zp2tf(z,p,K)

But it appears it doesn't work correctly when the coefficients of the transfer function $H(z)$ are complex. And it gives a different response compared to the expected response.

This is the expected transfer function: $$H(z)=\frac{1+(-1.3745-0.77689i)z^{-1}+(0.46331+0.85406i)z^{-2}}{1+ (0.83665-0.023904i)z^{-1}+(0.91366+0.061999i)z^{-2}}$$

  • $\begingroup$ Saying "it doesn't work" is like saying "the car is broken". It gives us zero information about what information you need. What isn't working? Do you have a Matlab license? $\endgroup$
    – Peter K.
    May 7, 2016 at 23:16
  • $\begingroup$ Are the given poles an zeros from the s-domain or z-domain. If it is the last then it should work since freqz assumes it is a IIR filter. $\endgroup$
    – fibonatic
    May 7, 2016 at 23:42
  • $\begingroup$ I have edited the question. @fibonatic ,from the z-domain $\endgroup$ May 7, 2016 at 23:59
  • 1
    $\begingroup$ It would help if you showed us the complete code. We don't know what you used for z and p in the first line of your code. I don't understand why you need zp2tf if you already have numerator and denominator coefficients, as given by the equation in your question. $\endgroup$
    – Matt L.
    May 8, 2016 at 12:38
  • $\begingroup$ Edited. Note: I don't have numerator and denominator coefficients, the given equation shows the expected coefficients where zp2tf returns real num and den $\endgroup$ May 8, 2016 at 16:07

1 Answer 1


The MathWorks Documentation of the function zp2tf says that

The zeros and poles must be real or come in complex conjugate pairs.

which is not the case for your example. With the given values of the vectors z and p you can do the following:

num = poly(z);
den = poly(p);

which gives

1.00000 + 0.00000i -0.37545 - 0.77876i 0.09714 - 0.02978i

for num, and

1.00000 + 0.00000i 0.83665 + 0.07610i 1.00092 + 0.10802i

for den. Note that these are different from the coefficients of your 'expected transfer function'. However, these coefficients correspond to the given pole and zero locations.

Also note that one of your poles lies outside the unit circle, so your filter is unstable.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.