Engee documentation
Notebook

Location of poles and zeros

This example shows how to investigate the location of poles and zeros of dynamical systems. This can be done graphically by plotting a map using pzmap. Or you can find the numerical values using the function zpkdata.

Studying the location of poles and zeros can be useful for problems such as stability analysis. This example compares two closed-loop systems that have the same transfer function of the control object and different controllers.


Let's create two models of closed-loop systems.

In [ ]:
Pkg.add(["ControlSystems"])
In [ ]:
using ControlSystems

G = zpk([], [-5, -5, -10], 100)
C1 = pid(2.9, 7.1)
CL1 = feedback(G * C1, 1)
C2 = pid(29, 7.1)
CL2 = feedback(G * C2, 1)
Out[0]:
TransferFunction{Continuous, ControlSystemsBase.SisoZpk{Float64, ComplexF64}}
                              (1.0s + 5.000000140181413)(1.0s + 4.999999859818593)(1.0s + 0.14084507042253516)
2900.0---------------------------------------------------------------------------------------------------------------------------------
      (1.0s + 5.0)(1.0s + 5.0)(1.0s + 21.10553800168399)(1.0s^2 - 1.2358649411320777s + 148.49404080219574)(1.0s + 0.13032693944811272)

Continuous-time transfer function model

Controller C2 has a much higher proportional gain. Otherwise, the two closed loop systems CL1 and CL2 are identical.

Graphically examine the pole and zero locations of both systems.

In [ ]:
pzmap(CL1,label="CL1")
pzmap!(CL2,label="CL2")
Out[0]:

pzmap displays the location of poles and zeros on the complex plane as x and o labels, respectively. When multiple models are provided, the poles and zeros of each model are displayed in a different colour. Here, the poles and zeros of CL1 are highlighted in orange, and the poles and zeros of CL2 are highlighted in purple. The zeros of the functions are the same, so overlapping them results in a green colour.

The graph shows that all the poles of CL1 are in the left half-plane and, therefore, CL1 is stable. The model of the system CL2 contains poles in the right half-plane, so it is unstable.

Let us compute the numerical values of the locations of the poles and zeros in CL2 using zpkmap. This cuction returns three values in the following order: gain (k), poles (p), zeros (z).

In [ ]:
z,p,k = zpkdata(CL2)
display(z)
display(p)
1×1 Matrix{Vector{ComplexF64}}:
 [-5.000000140181413 + 0.0im, -4.999999859818593 + 0.0im, -0.14084507042253516 + 0.0im]
1×1 Matrix{Vector{ComplexF64}}:
 [-5.0 + 0.0im, -5.0 + 0.0im, -21.10553800168399 + 0.0im, 0.6179324705660388 + 12.170135589385021im, 0.6179324705660388 - 12.170135589385021im, -0.13032693944811272 + 0.0im]

There is also a separate function to find the poles - poles, and to find the zeros - tzeros. Let's find the individual values for the CL1 system.

In [ ]:
poles(CL2)
Out[0]:
6-element Vector{ComplexF64}:
                 -5.0 + 0.0im
                 -5.0 + 0.0im
   -21.10553800168399 + 0.0im
   0.6179324705660388 + 12.170135589385021im
   0.6179324705660388 - 12.170135589385021im
 -0.13032693944811272 + 0.0im
In [ ]:
tzeros(CL1)
Out[0]:
3-element Vector{ComplexF64}:
  -5.0000000890586955 + 0.0im
   -4.999999910941301 + 0.0im
 -0.14084507042253533 + 0.0im

tzero and poles return column vectors containing the locations of zeros and poles of the system.

By knowing the locations of the poles and zeros of the transfer function of the system, we can judge its stability. More functions for analysing the stability of a system can be found in Analysis.