Computes the feedback gain K for the state space system according to assigned close loop poles
function testPoleAssignment2
extends Modelica.Icons.Function;
import Complex;
import Modelica_LinearSystems2.ComplexMathAdds;
import Re = Modelica.ComplexMath.real;
import Im = Modelica.ComplexMath.imag;
import Modelica.ComplexMath.j;
import Modelica.Utilities.Streams.print;
import Modelica_LinearSystems2.StateSpace;
input String dataFile = TestDataDir + "data_Byers6.mat" annotation(
Dialog(group = "system data definition", loadSelector(filter = "MAT files (*.mat);; All files (*.*)", caption = "state space system data file")));
input Types.AssignPolesMethod method = Tests.Types.AssignPolesMethod.KNV "method for pole assignment";
input Boolean isSI = true;
input String outputFile = "";
input Boolean deleteExistingOutputfile = true;
output Real K[size(B, 2), size(A, 1)] "Feedback gain matrix";
output Complex calcPoles[:];
output Real kappa2 "condition number kappa_2(X) = ||X||_2 * ||inv(X)||_2";
output Real kappaF "condition number kappa_F(X) = ||X||_F * ||inv(X)||_F";
output Real zeta "condition number by Byers, zeta(X) = (||X||_F)^2 + (||inv(X)||_F)^2";
output Real cInf "condition number vu1=||c||_inf = max(c_j)";
output Real nu2 "Euclidean norm of the feedback matrix";
output Real nuF "Frobenius norm of the feedback matrix";
output Real dlambda "Distance between the assigned and the calculated poles";
output Real gap = 0.0;
output Real Jalpha[11] "Combined condition number, JKX=alpha/2*(kappa2X_B) + (1-alpha)/2*normFroK^2";
output Complex X[:, :] "right eigenvectors of the closed loop system";
end testPoleAssignment2;