functionreadMatrixC2

Read the output matrix of a state space system

Extends from Modelica.Icons.Function (Icon for functions).

Information

Syntax

C = Streams.readMatrixC2(fileName, matrixName, nx, ny);

Description

Opens the given MATLAB MAT file and returns the submatrix C of the matrix matrixName given as

C[ny, nx] = matrixName[nx+1:nx+ny, 1:nx];

Example

// Generate dslin.mat of the double pendulum example first
Modelica_LinearSystems2.Utilities.Import.linearize(
  "Modelica_LinearSystems2.Utilities.Plants.DoublePendulum", 1.0);

// Read C matrix of the linearized system
readMatrixC2("dslin.mat", "ABCD", 6, 8)
//  = 
// [0.9999999999670585, 0.0, 0.0, 0.0, 0.0, 0.0;
// 0.0, 1.0000000001008236, 0.0, 0.0, 0.0, 0.0;
// 0.0, 0.0, 1.0000000005428915, 0.0, 0.0, 0.0;
// 0.0, 0.0, 0.0, 1.000000000091112, 0.0, 0.0;
// 0.0, 0.0, 0.0, 0.0, 0.9999999999578305, 0.0;
// 0.0, 0.0, 0.0, 0.0, 0.0, 1.000000000038966;
// 0.0, 0.0, 0.0, 0.0, 0.0, 0.0;
// 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

Inputs

TypeNameDefaultDescription
StringfileNameDataDir + "abcd.mat"
StringmatrixName"ABCD"Name of the generalized state space system matrix
IntegernxSystem order
IntegernyNumber of outputs

Outputs

TypeNameDefaultDescription
Real[ny,nx]CABCD[nx + 1:nx + ny, 1:nx]