functionreadMatrixA2
Read the state matrix of a state space system
Extends from Modelica.Icons.Function (Icon for functions).
Information
Syntax
A = Streams.readMatrixA2(fileName, matrixName, nx);
Description
Opens the given MATLAB MAT file and returns the submatrix A of the matrix
matrixName given as
A[nx, nx] = matrixName[1:nx, 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 A matrix of the linearized system
readMatrixA2("dslin.mat", "ABCD", 6)
// =
// [0.0, 1.0000000001008236, 0.0, 0.0, 0.0, 0.0;
// 0.0, 0.0, -2.6206364377231033, 1.2573088155408514, -0.779772901933996, 0.1247427420611989;
// 0.0, 0.0, 0.0, 1.000000000091112, 0.0, 0.0;
// 0.0, 0.0, -0.19138983233984724, 3.539452887205103, -3.1119345375319445, 1.6015423818240417;
// 0.0, 0.0, 0.0, 0.0, 0.0, 1.000000000038966;
// 0.0, 0.0, -7.229008278422499, 1.3904525205542553, 3.4263760991964918, -1.0645822524481547]
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| String | fileName | DataDir + "abcd.mat" | |
| String | matrixName | "ABCD" | Name of the generalized state space system matrix |
| Integer | nx | System order |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Real[nx,nx] | A | ABCD[1:nx, 1:nx] |