functiontoMatrices
Convert a TransferFunction into the matrices A, B, C of a StateSpace
Information
Syntax
(A, B, C, D) = TransferFunction.Conversion.toStateSpacetoStateSpace(tf)
Description
Transforms a transfer function into state space representation. The outputs are the system functions A, B, C, D. There are an infinite number of possible realizations. Here, the transfer function is transformed into controller canonical form, i.e. the transfer function
b4*s^4 + b3*s^3 + b2*s^2 + b1*s + b0
y = -------------------------------------- * u
a4*s^4 + a3*s^3 + a2*s^2 + a1*s + a0
is transformed into:
der(x) = A*x + B*u;
y = C*x + D*u;
with
A = [ 0 , 1 , 0 , 0;
0 , 0 , 1 , 0:
0 , 0 , 0 , 1;
-a0/a4, -a1/a4, -a2/a4, -a3/a4];
B = [ 0;
0;
0;
1/a4];
C = [b0-b4*a0/a4, b1-b4*a1/a4, b2-b4*a2/a4, b3-b4*a3/a4];
D = [b4/a4];
If the numerator polynomial is 1, then the state vector x is built up of y and of all derivatives of y up to nx-1 (nx is the dimension of the state vector):
x = {y, dy/dt, d^2y/dt^2, ..., d^(n-1)y/dt^(n-1)};
Note, the state vector x of Modelica.Blocks.Continuous.TransferFunction is defined slightly differently.
Example
TransferFunction s = Modelica_LinearSystems2.TransferFunction.s(); Modelica_LinearSystems2.TransferFunction tf=(s+1)/(s^3 + s^2 + s +1); algorithm (A, B, C, D) := Modelica_LinearSystems2.TransferFunction.Conversion.toStateSpace(tf); // A = [0, 1, 0; 0, 0, 1; -1, -1, -1], // B = [0; 0; 1], // C = [1, 1, 0], // D = [0],
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Modelica_LinearSystems2.TransferFunction | tf | Transfer function of a system |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real[size(tf.d, 1),size(tf.d, 1)] | ABCD |