Skip to content

ComplexWarning while trying to plot a pzmap #288

Open
@fabiomolinar

Description

@fabiomolinar

I would like to understand why the zeros from my sys3 transfer function below aren't being plotted by the pzmap function.

#sys1
num = [6., 0., 1.]
den = [1., 3., 3., 1.]
sys = control.tf(num, den)

#sys2
n1 = [1., 1.]
n2 = [1., 2.]
d1 = [1., 2.j]
d2 = [1., -2.j]
d3 = [1., 3.]
num2 = np.convolve(n1, n2)
den2 = np.convolve(d1,np.convolve(d2, d3))
sys2 = control.tf(num2, den2)

#sys3
num3 = np.convolve(num, den2)
den3 = np.convolve(den, num2)
sys3 = control.tf(num3, den3)

control.pzmap(sys3, Plot=True, title="Mapa de polos e zeros")

When control.pzmap runs, it returns the correct poles and zeros, together with a plot. The problem is, this plot contains only the roots of the sys3 transfer function. Together with the plot, I am also getting the following warning message:

xxx/anaconda3/lib/python3.7/site-packages/control/xferfcn.py:864: ComplexWarning: Casting complex values to real discards the imaginary part
  num[i, j, np+1-len(numpoly):np+1] = numpoly[::-1]

If the problem is the removal of the imaginary parts by that part of the algorithm, why is that happening then?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions