Python provided Feedback Transfer function is not matching with the manually computed Transfer Function

control theorypython

I am new to Control Theory and started learning it recently. I am following Modern Control Engineering by Ogata. I have come across the Obtaining Cascaded, Parallel, and Feedback Transfer Functions with MATLAB Section. Below is the diagram for serial, parallel, and Feedback Transfer functions.

Block Diagram for serial, parallel, and Feedback Transfer functions

In this, if I take two systems

>>> sys1

      10
--------------
s^2 + 2 s + 10
>>> sys2

  5
-----
s + 5

For series(a) transfer function, the result would be G1(s) X G2(s).

For the below python program,

import control
sys1 =  control.tf([10],[1,2,10]) # Equivalent to G1(s)
sys2 = control.tf([5],[1,5])      # Equivalent to G2(s)
series_sys = control.series(sys1,sys2)
print(series_sys)

I get this output

          50
-----------------------
s^3 + 7 s^2 + 20 s + 50

This output is matching with my hand calculations.

If I try the same thing with parallel transfer functions, the output is matching with G1(s)+G2(s)

>>> control.parallel(sys1,sys2)

  5 s^2 + 20 s + 100
-----------------------
s^3 + 7 s^2 + 20 s + 50

But for the Feedback Transfer functions, the output is not matching with G1(s)/{1+[G1(s) X G2(s)]} (This is the resultant Transfer function for feedback systems, or is my understanding is wrong ? )

If I calculate the transfer function for this using python, I get the below output. I have compared this with Octave. The results in both are the same.

>>> control.feedback(sys1 , sys2)

        10 s + 50
------------------------
s^3 + 7 s^2 + 20 s + 100

But if I calculate the transfer function using the above formula, I am getting the following result:

        10 s^3 + 70 s^2 + 200 s + 500
---------------------------------------------
s^5 + 9 s^4 + 44 s^3 + 210 s^2 + 400 s + 1000

I am doing anything wrong, or is my understanding of the feedback transfer function wrong?

Kindly help me understand this.

Best Answer

Notice that

$$ \require{cancel} \frac{10 s^3 + 70 s^2 + 200 s + 500}{s^5 + 9 s^4 + 44 s^3 + 210 s^2 + 400 s + 1000} = \frac{(10 s + 50)\cancel{(s^2 + 2s + 10)}}{(s^3 + 7 s^2 + 20 s + 100)\cancel{(s^2 + 2s + 10)}} $$

What you see happens because of numeric inaccuracy so the pole/zero cancellation is not done.