D = Streams.readMatrixD2(fileName, matrixName, nx, nu, ny);
Opens the given MATLAB MAT file and returns the submatrix D of the matrix
matrixName
given as
D[ny, nu] = ABCD[nx+1:nx+ny, nx+1:nx+nu];
// Generate dslin.mat of the double pendulum example first Modelica_LinearSystems2.Utilities.Import.linearize( "Modelica_LinearSystems2.Utilities.Plants.DoublePendulum", 1.0); // Read D matrix of the linearized system readMatrixD2("dslin.mat", "ABCD", 6, 1, 8) // = // [0.0; // 0.0; // 0.0; // 0.0; // 0.0; // 0.0; // 0.0; // 0.0]
function readMatrixD2 extends Modelica.Icons.Function; input String fileName = DataDir + "abcd.mat" annotation( Dialog(loadSelector(filter = "MAT files (*.mat);; All files (*.*)", caption = "state space system data file"))); input String matrixName = "ABCD" "Name of the generalized state space system matrix"; input Integer nx "System order"; input Integer nu "Number of inputs"; input Integer ny "Number of outputs"; output Real D[ny, nu] = ABCD[nx + 1:nx + ny, nx + 1:nx + nu]; end readMatrixD2;