Clear Filters
Clear Filters

pzmap and bode do not return zeros for all specified outputs

7 views (last 30 days)
I derived the state-space description of a simple RC network and now want to inspect its poles and (tranmission) zeroes. Surprisingly, pzmap, tzero(systf), and tzero(systss) refuse to return the zeros, while the pretty-printed result from the ZPK function clearly shows them.
% State Equation dx/dt = A x + B u
A = [
-1.6551724137931035e+0003 6.2068965517241384e+0002 1.0344827586206895e+0003
6.4998468694961241e+0002 -2.5999387477984496e+0003 1.9499540608488371e+0003
5.7471264367816090e+0001 1.0344827586206897e+0002 -1.1609195402298849e+0003 ];
B = [
0.0000000000000000e+0000
0.0000000000000000e+0000
1.0000000000000000e+0003 ];
C = [
1.0000000000000000e+0000 0.0000000000000000e+0000 0.0000000000000000e+0000
0.0000000000000000e+0000 1.0000000000000000e+0000 0.0000000000000000e+0000
0.0000000000000000e+0000 0.0000000000000000e+0000 1.0000000000000000e+0000 ];
D = [
0.0000000000000000e+0000
0.0000000000000000e+0000
0.0000000000000000e+0000 ];
xnames = ["v_{C3}" "v_{C2}" "v_{C1}" ];
unames = ["V1" ];
cname = 'Laplace';
sysss = ss(A,B,C,D); systf = tf(sysss); syszpk = zpk(sysss);
figure(1); bodef(systf); figure(2); pzmap(systf);
P = pole(systf); Z = tzero(systf);
sysss, systf, syszpk, Z, P
The printed result is
>> run 'd:\dfwforth\examples\SPICE\ispice\circuits\net_lts\laplace\Laplace.m'
sysss =
A =
x1 x2 x3
x1 -1655 620.7 1034
x2 650 -2600 1950
x3 57.47 103.4 -1161
B =
u1
x1 0
x2 0
x3 1000
C =
x1 x2 x3
y1 1 0 0
y2 0 1 0
y3 0 0 1
D =
u1
y1 0
y2 0
y3 0
Continuous-time state-space model.
Model Properties
systf =
From input to output...
1.034e06 s + 3.9e09
1: ------------------------------------
s^3 + 5416 s^2 + 8.579e06 s + 3.9e09
1.95e06 s + 3.9e09
2: ------------------------------------
s^3 + 5416 s^2 + 8.579e06 s + 3.9e09
1000 s^2 + 4.255e06 s + 3.9e09
3: ------------------------------------
s^3 + 5416 s^2 + 8.579e06 s + 3.9e09
Continuous-time transfer function.
Model Properties
syszpk =
From input to output...
1.0345e06 (s+3770)
1: ---------------------------
(s+2969) (s+1652) (s+795.3)
1.95e06 (s+2000)
2: ---------------------------
(s+2969) (s+1652) (s+795.3)
1000 (s+2919) (s+1336)
3: ---------------------------
(s+2969) (s+1652) (s+795.3)
Continuous-time zero/pole/gain model.
Model Properties
Z =
0×1 empty double column vector
P =
1.0e+03 *
-2.9692
-1.6515
-0.7953
>>
Z is 0x1 vector? The pzmap plot only shows poles:
What am I doing wrong? Is it that MATLAB's pzmap has a problem with the fact that this (MIMO) network has 3 transfer functions?

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 14 Dec 2023
Here is the corrected code:
A = [
-1.6551724137931035e+0003 6.2068965517241384e+0002 1.0344827586206895e+0003
6.4998468694961241e+0002 -2.5999387477984496e+0003 1.9499540608488371e+0003
5.7471264367816090e+0001 1.0344827586206897e+0002 -1.1609195402298849e+0003 ];
B = [
0.0000000000000000e+0000
0.0000000000000000e+0000
1.0000000000000000e+0003 ];
C = [
1.0000000000000000e+0000 0.0000000000000000e+0000 0.0000000000000000e+0000
0.0000000000000000e+0000 1.0000000000000000e+0000 0.0000000000000000e+0000
0.0000000000000000e+0000 0.0000000000000000e+0000 1.0000000000000000e+0000 ];
D = [
0.0000000000000000e+0000
0.0000000000000000e+0000
0.0000000000000000e+0000 ];
xnames = ["v_{C3}" "v_{C2}" "v_{C1}" ];
unames = ["V1" ];
cname = 'Laplace';
sysss = ss(A,B,C,D);
systf = tf(sysss);
[ZeroS, PoleS, GainS] = zpkdata(sysss)
ZeroS = 3×1 cell array
{[-3.7699e+03]} {[ -2000]} {2×1 double }
PoleS = 3×1 cell array
{3×1 double} {3×1 double} {3×1 double}
GainS = 3×1
1.0e+06 * 1.0345 1.9500 0.0010
figure(1); bode(systf); figure(2); pzmap(systf(1,1)), hold on;pzmap(systf(2,1)), pzmap(systf(3,1))
% P = pole(systf); Z = tzero(systf);
% sysss, systf, syszpk, Z, P
  2 Comments
marcel hendrix
marcel hendrix on 14 Dec 2023
Thanks a lot!
For completeness, I added
syszpk = zpk(Z,P,G)
to pretty print the factored transfer functions, and
[r,c]=size(systf); hold on; for iy=c, for ix=1:r, pzmap(systf(ix,iy)); end; end;
to plot all.

Sign in to comment.

More Answers (1)

Paul
Paul on 15 Dec 2023
Edited: Paul on 15 Dec 2023
Hi Marcel,
There isn't really a problem. If you want to get the pzmap of each individual transfer function of MIMO system, then you have to call pzmap on each individual I/O pair in the system, as in @Sulaymon Eshkabilov's answer. If all you want are the pzmaps, there's no need to convert the ss model to a tf (and if you already have an ss object, there's rarely, if ever a need to convert to tf, and if you do want to convert to tf consider converting to zpk instead).
A = [
-1.6551724137931035e+0003 6.2068965517241384e+0002 1.0344827586206895e+0003
6.4998468694961241e+0002 -2.5999387477984496e+0003 1.9499540608488371e+0003
5.7471264367816090e+0001 1.0344827586206897e+0002 -1.1609195402298849e+0003 ];
B = [
0.0000000000000000e+0000
0.0000000000000000e+0000
1.0000000000000000e+0003 ];
C = [
1.0000000000000000e+0000 0.0000000000000000e+0000 0.0000000000000000e+0000
0.0000000000000000e+0000 1.0000000000000000e+0000 0.0000000000000000e+0000
0.0000000000000000e+0000 0.0000000000000000e+0000 1.0000000000000000e+0000 ];
D = [
0.0000000000000000e+0000
0.0000000000000000e+0000
0.0000000000000000e+0000 ];
xnames = ["v_{C3}" "v_{C2}" "v_{C1}" ];
unames = ["V1" ];
cname = 'Laplace';
sysss = ss(A,B,C,D);
figure
pzmap(sysss(1,1),sysss(2,1),sysss(3,1))
You may also be interested in iopzmap and iopzplot.
The documentation for pzmap states that "For SISO systems, pzmap plots the system poles and zeros. For MIMO systems, pzmap plots the system poles and transmission zeros." And it later says that these zeros are the output of tzero.
The concept of zeros, paticularly for non-SISO systems is very complex and can be tricky even for SISO sytems. In fact, it's so easy to get wrong that the second sentence in the quoted statement from the pzmap doc is actually incorrect.
Consider a simple SISO system:
h = zpk([-1],[-2 -3],1)
h = (s+1) ----------- (s+2) (s+3) Continuous-time zero/pole/gain model.
The system zeros are defined as the roots of the numerator, which in this case is s0 = -1, and is the result returned from tzero
tzero(h)
ans = -1
Now add an additional zero in the numerator at the same location as a pole
h = zpk([-1 -2],[-2 -3],1)
h = (s+1) (s+2) ----------- (s+2) (s+3) Continuous-time zero/pole/gain model.
Again, tzero returns both zeros from the numerator
tzero(h)
ans = 2×1
-2.0000 -1.0000
And both are showed by pzmap
figure
pzmap(h)
However, the zero at s0 = -2 IS NOT a transmission zero. And, if you check the doc page for tzero it says that if the system is non-minimal then the function actually returns the invariant zeros, not the transmission zeros (for the SISO case as in this example, system zeros and invariant zeros are the same). The doc page for pzmap should say that for MIMO systems it plots the invariant zeros.
Now, in your problem we have a system with 3 outputs and 1 input. For non-SISO (which I'll just call MIMO for generality) systems, the concept of zeros (and poles for that matter) becomes an absolute nightmare, and the nightmare becomes worse if we allow for systems with non-minimal state space realizations.
For MIMO systems, the invariant zeros as returned from tzero (and the transmission zeros which are the same as the invariant zeros or a subset of them depending on the system) will not, in general, be the same as the zeros of any individual transfer function in the transfer function matrix. In your example, each element of systf has one or more zeros, but the transfer function matrix as whole deoesn't have any invariant (or transmission) zeros, as indicated by tzero
tzero(sysss)
ans = 0×1 empty double column vector
The converse can also be true. Consider this 2x2 transfer function matrix
G = [zpk(1) zpk([],-3,1);0 1]
G = From input 1 to output... 1: 1 2: 0 From input 2 to output... 1 1: ----- (s+3) 2: 1 Continuous-time zero/pole/gain model.
None of the four elements have a zero, but the system as a whole has a transmission zero.
tzero(G)
ans = -3.0000
This link (from which I took the preceding example) may be of interest, and you can find many other resources on the net from university classes that go into additional related concepts. It's a really complicated topic. If you want a good textbook, try Linear Systems (Kailath); I'm sure there are many others.
  1 Comment
marcel hendrix
marcel hendrix on 15 Dec 2023
Hi Paul,
Thanks for the fabulous dissection of my question. You even solved problems I didn't know I had yet :--)
Some background: I am building a toolkit to help me with digital control of power electronics. The A,B,C,D matrices above are automatically generated from a SPICE netlist (the algorithm also works for switching circuits). MATLAB and Simulink are called from an interactive SPICE to give generalized overviews of the circuit/controller under consideration. That is the reason that both tf() and zpk() are used: tf() is useful for building s- and z-domain equivalent subcircuits, while zpk() more clearly shows (to an electronic engineer) how the circuit will behave.
In my question, I was plain wrong by assuming tzero() or zero() returns the same zeros as syszpk.z, and by assuming that if bode(sysss) plots all transfer functions, pzmap(syszpk) should plot all pole zero maps.

Sign in to comment.

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!