tss = StateSpace.Transformation.toSimilarForm(ss, T, inverted)
This function calculates a similar state space system, i.e.
der(z) = T*A*inv(T)*z + T*B*u
y = C*T*z + D*u
if inverted==false and
der(z) = inv(T)*A*T*z + inv(T)*B*u
y = C*inv(T)*z + D*u
if inverted=true. Matrix T has to be invertible. The transformed system has the same eigenvalues.
Modelica_LinearSystems2.StateSpace ss=Modelica_LinearSystems2.StateSpace(
A=[-1, 1; 0, -2],
B=[1; 0],
C=[0, 1],
D=[0]);
Real T[2,2]=[1, 1;0, sqrt(2)];
algorithm
tss:=Modelica_LinearSystems2.StateSpace.Transformation.toSimilarForm(ss, T, false);
// tss=StateSpace(
A=[-1, 0; 0, -2],
B=[1; 0],
C=[0, 1/sqrt82)],
D=[0])
encapsulated function toSimilarForm
import Modelica;
import Modelica_LinearSystems2;
import Modelica_LinearSystems2.StateSpace;
import Modelica.Math.Matrices;
input StateSpace ss "State space system";
input Real T[size(ss.A, 2), size(ss.A, 1)] = identity(size(ss.A, 1)) "Transformation matrix";
input Boolean inverted = false "Is false (default) for transformation z = Tx, true for x = Tz" annotation(
choices(checkBox = true));
output StateSpace tss(redeclare Real A[size(ss.A, 1), size(ss.A, 2)], redeclare Real B[size(ss.B, 1), size(ss.B, 2)], redeclare Real C[size(ss.C, 1), size(ss.C, 2)], redeclare Real D[size(ss.D, 1), size(ss.D, 2)]) "Transformed state space system";
end toSimilarForm;