3.1 Transfer Function Representations
The basic form for representing transfer function matrices is the TransferFunction data structure. TransferFunction in many respects behaves like Function, the builtin Mathematica pure function. Like Function, TransferFunction can have a formal parameter, "variable", and is capable of operating on any Mathematica expression. Unlike Function, TransferFunction currently accepts at most one formal parameter and does not accept the list of attributes, but it does accept options.
Transfer function representation as a pure function.
Load the application.
In[1]:=
This is the transfer function representation of a twoinput, oneoutput system. The TransferFunction object comprises a variable and a matrix in that variable.
In[2]:=
Out[2]=
Supplying the variable to this function leads to a matrix in that variable.
In[3]:=
Out[3]=
If a particular numeric frequency is supplied, the value of the transfer matrix at that frequency is obtained.
In[4]:=
Out[4]=
We can name the internal variable whatever we please or drop it altogether and still have a mathematically identical object.
In[5]:=
Out[5]=
Without the formal parameter, TransferFunction behaves as a pure function in #.
In[6]:=
Out[6]=
TransferFunction deals with multipleinput, multipleoutput (MIMO) systems. Scalar, or singleinput, singleoutput (SISO), transfer functions are "upgraded" to the matrix representation automatically.
A scalar transfer function is represented as a transfer matrix.
In[7]:=
Out[7]=
It is often useful to factor the elements of a transfer matrix so that the zeros and poles of individual elements become apparent. The factored form can be obtained by using the function FactorRational. The opposite function is ExpandRational, which expands the individual numerators and denominators of transfer matrix elements.
Converting transfer function objects to standard forms.
This is some rational polynomial transfer function.
In[8]:=
Out[8]=
This factors the numerators and denominators of all elements.
In[9]:=
Out[9]=
This expands the numerators and denominators of the previous result.
In[10]:=
Out[10]=
Both FactorRational and ExpandRational can be viewed as means to transformation arbitrary TransferFunction objects into their standard forms, whereas TransferFunction itself behaves merely as a wrapper with respect to polynomial expressions.
By itself, TransferFunction does not change polynomial expressions in a transfer function matrix.
In[11]:=
Out[11]=
However, ExpandRational and FactorRational do convert arbitrary rational polynomial matrices to the standard forms.
In[12]:=
Out[12]=
In[13]:=
Out[13]=
The coefficients of the factored form of the individual transfer matrix elements (i.e., zeros, poles, and gains) can be stored using the special data structure ZeroPoleGain. To allow complete restoration of the transfer function object from its zeropolegain equivalent, ZeroPoleGain may optionally contain the variable used in the transfer function.
ZeroPoleGain data structure.
Structurally, both zeros and poles are matrices of vectors of the corresponding coefficients, whereas gains is just a matrix of coefficients. All three of these matrices and the parent transfer matrix have the same dimensions down to the second level.
Here is another transfer function.
In[14]:=
Out[14]=
This picks up its zeros, poles, and gains. Notice that there are no finite zeros in the first element of the transfer matrix, so the corresponding list of zeros is empty.
In[15]:=
Out[15]=
Applying TransferFunction to the ZeroPoleGain object brings out the transfer function in its factored form.
In[16]:=
Out[16]=
The same result can be arrived at directly.
In[17]:=
Out[17]=
Like TransferFunction objects, ZeroPoleGain objects need not have a named variable. If a ZeroPoleGain object does not have one, neither will the descendent transfer function.
This system does not have finite zeros, has a single pole at the origin, and has a unit gain. Therefore, it represents an ideal integrator.
In[18]:=
Out[18]=
Here is its transfer function. As no variable was used in the parent ZeroPoleGain, none appears here.
In[19]:=
Out[19]=
It is worth emphasizing that the variable in the TransferFunction and ZeroPoleGain objects is a formal parameter and has nothing to do with distinguishing Laplace and transform domains (which is what the Sampled option is for; see Section 3.3). The variable may simply be omitted or easily renamed if desired using the builtin Mathematica functions. Again, renaming does not change the domain of the object; to transform the system from one domain to another, use either ToDiscreteTime (Section 3.5) or ToContinuousTime (Section 3.7), whichever is appropriate. Note, however, that interpretation of the TransferFunction object in TraditionalForm obeys a different convention and does take the variable into account (see Section 3.4).
This is a transfer function in the variable var.
In[20]:=
Out[20]=
This changes the variable to z. No change of domain has occurred.
In[21]:=
Out[21]=
Two additional utility functions, Zeros and Poles, return zeros and poles of transfer functions for control objects. In the case of ZeroPoleGain objects, these functions simply extract the relevant parts from the data structure.
Computing zeros and poles separately.
Both TransferFunction and ZeroPoleGain, as well as the head StateSpace described in Section 3.2, work as "active wrappers". This means that, on the one hand, they keep system components together allowing the system as a whole to be conveniently passed from one function to another. They can also be used for conversion between the data structures when one wrapper is applied over another.
Converting from statespace to transfer function representation.
The straightforward, but computationally expensive, way of finding the transfer function matrix of a statespace realization is based on the formula
The method involves computing the inverse of the matrix (the socalled resolvent matrix) and is accessible by setting the option value ReductionMethodInverse. A better alternative is often to scan the determinant expansion formula for a singleinput, single output system over all possible inputoutput pairs of a multiinput, multioutput system (cf. Kailath (1980), Appendix A)
Here the notation stands for the determinant of the matrix, and are the column and rowvector components of the matrices B and C that correspond to the given inputoutput pair, is the corresponding scalar part of the matrix D, and is the same for the transfer function matrix H. This method is available under the option value DeterminantExpansion, which is the default value of the option ReductionMethod. Although the above formulas refer to the continuoustime case, the implemented algorithms are equally applicable to discretetime systems.
For conversion and most other purposes, the elements of the transfer matrix must be rational polynomials. However, nonrational polynomial terms can also be handled in some cases, notably in some frequency response functions (Chapter 5) and system interconnection functions (Chapter 6).
