ss2zp and tf2zp give different results?

4 views (last 30 days)
Todd
Todd on 5 Apr 2013
I'm having trouble determining what I've done wrong here but basically I did 2 separate methods by mistake to get the zpk of transfer function and they gave different answers.
I know the state space however I need to determine the transfer function and I noticed that the gains of the transfer function and the zero-pole gain version were different. I used 2 different methods to get the zpk to figure out what went wrong and they gave different solutions. Any help would be greatly appreciated especially if someone can explain to me what I've done wrong or misunderstood. Thanks, Todd. (Sorry for the big ugly matrix.)
Code:
A =[-0.0256, 0.0816, -0.9807, -9.8091, 0.0000;
-0.2471, -2.0162, 70.3082, -0.1336, -0.0010;
0.0031, -0.1344, -2.9346, 0.0000, 0.0000;
0, 0, 1.0000, 0, 0;
-0.0136, 0.9999, 0, -72.0160, 0];
B = [5.0037, 0;
-0.0005, -13.1771;
0.0003, -23.4116;
0, 0;
0, 0];
C = [0, 0, 0, 0, 1];
D = [0,0];
[z1,p1,k1] = ss2zp(A,B,C,D,1);
Gzpk1 = zpk(z1,p1,k1) %zpk from ss2zp
[num,den] = ss2tf(A,B,C,D,1);
Gzpk2 = zpk(tf(num,den)) %zpk from ss2tf differs
% example from help file that works
b = [2 3 0];
a = [1 0.4 1];
gzpk1=zpk(tf(b,a)) % match
[A,B,C,D] = tf2ss(b,a);
[z2,p2,k2] = ss2zp(A,B,C,D,1);
gzpk2=zpk(z2,p2,k2) % match

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 5 Apr 2013
Edited: Azzi Abdelmalek on 5 Apr 2013
If you want to make a correct comparison
[z2,p2,k2] = zpkdata(Gzpk2,'v')
[sort(z1) sort(z2)]
[sort(p1) sort(p2)]
[sort(k1) sort(k2)]
  2 Comments
Todd
Todd on 6 Apr 2013
Edited: Todd on 6 Apr 2013
Thanks, this shows me that the ss2zp method has one less zero than the zpk(tf) method. I still don't understand why this is happening. :S
I think what happens is that one method cancels insignificant zeros. I don't know how accurate that is when analysing system responses but .... I think that's what happens.
Azzi Abdelmalek
Azzi Abdelmalek on 6 Apr 2013
if there is less zeros, how will you write ?
[sort(z1) sort(z2)]

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!