question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simplifying transfer functions?

See original GitHub issue

I have come across a simple example that puzzles me a little.

import control

s = control.TransferFunction.s

G1 = 1 / (1 + 3 * s)**2
G2 = 3 * (1 + 1 / 2 / s)
print(-G2 * control.feedback(G1, G2))
       -3 s^2 - 1.5 s
-----------------------------
9 s^4 + 6 s^3 + 4 s^2 + 1.5 s

The absence of automatic factorization and simplification here does not surprise me, but I would expect a function in the toolbox that would perform such an operation. Perhaps a control.simplify, which applied to the transfer function above would return the following function.

       -3 s - 1.5
-----------------------------
9 s^3 + 6 s^2 + 4 s + 1.5

Maybe I don’t know where to look, but I have not found such a function.

For the record, sympy allows me to do:

import sympy as sp

s = sp.symbols('s')

G1 = 1 / (1 + 3 * s)**2
G2 = 3 * (1 + 1 / 2 / s)

def feedback(G1, G2, sign=-1):
    return G1 / (1 - sign * G1 * G2)

G = -G2 * feedback(G1, G2)

print(G)
print(sp.simplify(G))
print(sp.expand(sp.simplify(G)))
print(sp.simplify(sp.expand(sp.simplify(G))))
(-3 - 1.5/s)/((3*s + 1)**2*((3 + 1.5/s)/(3*s + 1)**2 + 1))
(-3*s - 1.5)/(s*(3*s + 1)**2 + 3*s + 1.5)
-3*s/(9*s**3 + 6*s**2 + 4*s + 1.5) - 1.5/(9*s**3 + 6*s**2 + 4*s + 1.5)
(-3*s - 1.5)/(9*s**3 + 6*s**2 + 4*s + 1.5)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ilayncommented, Sep 18, 2022

Integer coefficients as opposed to what?

Floats. Read more about it on Wilkinson’s polynomial

0reactions
amosniercommented, Sep 24, 2022

@juanodecc, thanks a lot, I had missed the text

cancelling pole-zero pairs in transfer functions

in the documentation of that function. Gives me:

         -0.3333 s - 0.1667
------------------------------------
s^3 + 0.6667 s^2 + 0.4444 s + 0.1667

which is quite good.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transfer function algebra - x-engineer.org
In a parallel connection of transfer functions the same input is fed to all the transfer functions and all the outputs are summed...
Read more >
Control Systems - Block Diagram Reduction - Tutorialspoint
Follow these rules for simplifying (reducing) the block diagram, which is having many blocks, summing points and take-off points. ... Note − The...
Read more >
How to simplify transfer function? - MATLAB Answers
I have used the function s=tf('s') to ceate a transfer function, but I find that Matlab do not simplify the tf at all....
Read more >
Section 5 Block Diagrams.pdf
Often want to simplify block diagrams into simpler, recognizable forms. □ To determine the equivalent transfer function. □ Simplify to instances of the ......
Read more >
Finding the Transfer Function and Simplifying it to Standard ...
The answer given by the gentleman before is valid, but factor R2 in the numerator R2(1+sR1C1), then s in the denominator and then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found