# The numerator returned from ord2 function is not directly compatible with tf2zpk function.

4 views (last 30 days)
James Richard on 31 Jul 2022
Commented: James Richard on 31 Jul 2022
Background
Let's say there's a design requirement to build an overdamped closed loop system, such that second order LTI LPF ZIC prototype transfer function is choosen with omega_n = 1 rad/s and zeta = 2.
[num,den] = ord2(1,2)
sys = tf(num,den)
Then the output on the command window will be
num =
1
den =
1 4 1
sys =
Transfer function:
1
-------------
s^2 + 4 s + 1
Problem
This is a trouble if i want to convert it directly to zpk model.
[num,den] = ord2(1,2)
[z,p,k] = tf2zpk(num,den)
sys = zpk(z,p,k)
The output on the command window will be
num =
1
den =
1 4 1
z =
0
0
p =
-3.7321
-0.2679
k = 1
sys =
Transfer function:
s^2
-------------------
(s+3.732) (s+0.2679)
This is clearly different as we now have zeros in the transfer function.
Proposed Solution
The num returned by ord2 should be [0 0 1] instead of just 1.
I guess the problem was overlooked because they came from different toolboxes, ord2 came from Control System Toolbox while tf2zpk came from Signal Processing Toolbox.
And also the prototype given by ord2 is only LPF, there are other prototypes such as HPF, APF (all-pass filter), BPF, BSF.
##### 1 CommentShowHide None
James Richard on 31 Jul 2022
Edited: James Richard on 31 Jul 2022
My current solution would be
[num,den] = ord2(1,2)
sys = tf(num,den)
sys = zpk(sys)
But by doing this way i have to extract z, p, k again from the sys using zpkdata if i want to use it. It's just one extra step, but may be worth to explain it here.
[z, p, k] = zpkdata(sys)
I'm not sure how to format my whole post here, I just want to share my problem so that someone could google it and let other answer if they think they have better solution.

Paul on 31 Jul 2022
Edited: Paul on 31 Jul 2022
Hi James,
I'm not sure this really is a problem; all functions are working as documented. A shorter way to get the z,p,k of the continuous time representation is
[num,den] = ord2(1,2);
[z,p,k] = tf2zp(num,den)
z = 0×1 empty double column vector
p = 2×1
-3.7321 -0.2679
k = 1
For sure, be careful when mixing functionality from different toolboxes.
##### 1 CommentShowHide None
James Richard on 31 Jul 2022
Ok my fault. It's clearly documented. This is not because of mixing functionally. But my wrong intuition.
Who whould've tought that just small chamge in letter of k between tf2zpk and tf2zp could change night and day.
It should be renamed into tf2zpkpos tf2zpkneg or something better...

R2022a

### Community Treasure Hunt

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

Start Hunting!