Package controlsystems :: Module types :: Class TransferFunction
[hide private]

Class TransferFunction

source code

object --+
         |
        TransferFunction

TransferFunction type

This class implements the TransferFunction type, based on the Polynomial type. The TransferFunction object uses 2 polynomials to store the numerator and the denominator. For example:

>>> a = TransferFunction([1], [1, 2, 3])
>>> print a
Transfer Function:
.
.    1      
------------
s^2 + 2s + 3
Instance Methods [hide private]
 
__init__(self, num, den)
Initialization of TransferFunction object
source code
 
__str__(self)
String representation
source code
 
__add__(self, tf)
Operation of addition
source code
 
__sub__(self, tf)
Operation of subtraction
source code
 
__mul__(self, tf)
Operation of multiplication of polynomials
source code
 
simplify(self)
Simplify Transfer Functions
source code
 
mult(self, a)
Operation of multiplication between numbers and transfer functions
source code
 
div(self, a)
Operation of division of a transfer function per a number
source code
 
feedback_unit(self)
Feedback with unit gain
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, num, den)
(Constructor)

source code 

Initialization of TransferFunction object

This method initialize a TransferFunction object.

Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 
String representation

This method returns the string representation of the transfer
functions. For example:

    Transfer Function:
    .
    .     1      
    ------------
    s^2 + 2s + 3

Overrides: object.__str__

__add__(self, tf)
(Addition operator)

source code 

Operation of addition

This method returns a TransferFunction object with the result of the addition of the TransferFunction 'self' and the TransferFunction 'tf'. For example:

>>> a = TransferFunction([1], [1, 2, 3])
>>> b = TransferFunction([1], [2, 3, 4])
>>> c = a + b
>>> print c
Transfer Function:
.
.        3s^2 + 5s + 7         
------------------------------
2s^4 + 7s^3 + 16s^2 + 17s + 12
.
>>> type(c)
<class 'controlsystems.types.TransferFunction'>

__sub__(self, tf)
(Subtraction operator)

source code 

Operation of subtraction

This method returns a TransferFunction object with the result of the subtraction of the TransferFunction 'self' and the TransferFunction 'tf'. For example:

>>> a = TransferFunction([1], [1, 2, 3])
>>> b = TransferFunction([1], [2, 3, 4])
>>> c = a - b
>>> print c
Transfer Function:
.
.         s^2 + s + 1          
------------------------------
2s^4 + 7s^3 + 16s^2 + 17s + 12
.
>>> type(c)
<class 'controlsystems.types.TransferFunction'>

__mul__(self, tf)

source code 

Operation of multiplication of polynomials

This method returns a TransferFunction object with the result of the multiplication of the TransferFunction 'self'and the TransferFunction 'tf'. for example:

>>> a = TransferFunction([1], [1, 2, 3])
>>> b = TransferFunction([1], [2, 3, 4])
>>> c = a * b
>>> print c
Transfer Function:
.
.              1               
------------------------------
2s^4 + 7s^3 + 16s^2 + 17s + 12
.
>>> type(c)
<class 'controlsystems.types.TransferFunction'>

simplify(self)

source code 

Simplify Transfer Functions

This method returns a TransferFunction object with the transfer function simplified. For example:

>>> a = TransferFunction([3], [3, 6, 9])
>>> print a
Transfer Function:
.
.      3      
-------------
3s^2 + 6s + 9
.
>>> b = a.simplify()
>>> print b
Transfer Function:
.
.     1      
------------
s^2 + 2s + 3
.
>>> type(b)
<class 'controlsystems.types.TransferFunction'>

Attention: This method is far from perfect, and don't simplify all possible expressions, but it's usable.

mult(self, a)

source code 

Operation of multiplication between numbers and transfer functions

This method returns a TransferFunction object with the result of the multiplication of the TransferFunction 'self' and the number 'a'. For example:

>>> a = TransferFunction([1], [1, 2, 3])
>>> b = a.mult(5)
>>> print b
Transfer Function:
.
.       5       
---------------
5s^2 + 10s + 15
>>> type(b)
<class 'controlsystems.types.TransferFunction'>

div(self, a)

source code 

Operation of division of a transfer function per a number

This method returns a TransferFunction object with the result of the division of the coefficients of the TransferFunction 'self' and the number 'a'. For example:

>>> a = TransferFunction([3], [3, 6, 9])
>>> print a
Transfer Function:
.
.      3      
-------------
3s^2 + 6s + 9
.
>>> b = a.div(3)
>>> print b
Transfer Function:
.
.     1      
------------
s^2 + 2s + 3
.
>>> type(b)
<class 'controlsystems.types.TransferFunction'>

feedback_unit(self)

source code 

Feedback with unit gain

This method returns a TransferFunction object with the result of the unit gain feedback of the transfer function. For example:

>>> a = TransferFunction([1], [1, 2, 3])
>>> b = a.feedback_unit()
>>> print b
Transfer Function:
.
.         s^2 + 2s + 3        
-----------------------------
s^4 + 4s^3 + 11s^2 + 14s + 12
.
>>> type(b)
<class 'controlsystems.types.TransferFunction'>

Attention: This method is far from perfect, and don't simplify the expressions, but it's usable.