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)
[h,w]=freqz(num,den)
plot(w,abs(h))
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}}$$
z
andp
in the first line of your code. I don't understand why you needzp2tf
if you already have numerator and denominator coefficients, as given by the equation in your question. $\endgroup$zp2tf
returns realnum
andden
$\endgroup$