0
votes

Using the code for plot_pz([poles],[zeros])

function plot_pz(b,a) 

b_roots = roots(b);
a_roots = roots(a);

plot(b_roots,'x black');
plot(a_roots,'o blue');
axis equal;

I can get my b_roots to plot properly, but my a_roots continually plot on the 1+0i axis (or x=1). For example, the Z-Transform H(z) = [[1 2 2],[0 1 .8]] gives the following poles and zeros (per matlab):

poles =

  -1.0000 + 1.0000i
  -1.0000 - 1.0000i


zeros =

   -0.8000

It should look like this

Correct H(z)

but instead what I get is

Wrong H(z)

Where my zeros are at -1+1i and -1-1i, and my poles seem to be at 1-.8i, but should instead be at -.8+0i

I'm sure it's something simple that I'm missing, but I can't figure it out. I think it only happens when I have a single pole or a single zero.

Does plot(X) always default to plotting 1+xi?

1

1 Answers

1
votes

Fixed by being more clear with real() and imag()

plot(real(b_roots),imag(b_roots),'o blue');
plot(real(a_roots),imag(a_roots),'x red');