rrz0
rrz0

Reputation: 2302

Matlab - Converting zero-pole-gain to transfer function (zp2tf) not working as expected

I want to convert a transfer function to zero-pole-gain and then back to transfer function form.

tf -> tf2zp -> zp2tf -> tf

As I understand the output of zp2tf should return the original transfer function. However I cannot seem to get this to work.


I have a 5th order transfer function of the form:

enter image description here

I proceeded to find the zeros and poles for this transfer function to see which pole could be removed in order to reduce the order. Since this model consists of both an electrical and a mechanical part, the time constant for the electrical part is very small when compared to the mechanical time constants and due to this we can replace the electrical system with a gain and get an equivalent 4th order system.

To do so, I used this piece of code available on MathWorks, with the 5th order TF above:

b = [0.0001 10];
a = [0.005 5.00010060 0.661600001 61.01102010 2.1101 10];
fvtool(b,a,'polezero')
[b,a] = eqtflength(b,a);
[z,p,k] = tf2zp(b,a) 

The output was as follows, which is exactly what I had expected:

z = -100000

k = 0.02

enter image description here

and the equivalent PZ-map:

enter image description here

The above results show the pole associated with the electrical circuit, which is far to the left. This can be removed, thus reducing the order of the transfer function from 5th order to 4th order.

In order to reduce the order, I tried removing

My problem is that I cannot convert from zero-pole form to tf form using zp2tf (official docs here).

I followed the docs and entered my p, z and k values:

z = [-100000]';
p = roots([0.005 5.00010060 0.661600001 61.01102010 2.1101 10]);
k = 0.0200;
[b,a] = zp2tf(z,p,k)

I expected to see my original numerator and denominator, however the values are completely different:

enter image description here

Why am I not getting the poles and zeros that I started out with in the original transfer function?

Upvotes: 0

Views: 1770

Answers (1)

Sardar Usama
Sardar Usama

Reputation: 19689

You actually are getting the same transfer function. It is just that the numerator and denominator are multiplied by the factor of 200. Take 200 out as common in numerator and denominator and you'll see the same transfer function that you started with.

>> [bnew,anew] = zp2tf(z,p,k)
bnew =
   1.0e+03 *
    0.0000    2.0000         0         0         0         0

anew =
   1.0e+04 *
    0.0001    0.1000    0.0132    1.2202    0.0422    0.2000

>> bnew/200
ans =
    0.0001   10.0000         0         0         0         0

>> anew/200
ans =
    0.0050    5.0001    0.6616   61.0110    2.1101   10.0000

Upvotes: 1

Related Questions