.Modelica_LinearSystems2.ComplexMathAdds.eigenVectors

Information

Syntax

(eigvec, eigval) = eigenVectors(A);

Description

Calculate the eigenvectors and optionally (onlyEigenvectors=false) the eigenvalues of a state space system. The output eigenvectors is a matrix with the same dimension as matrix ss.A. Just like in Modelica.Math.Matrices.eigenValues, if the i-th eigenvalue has an imaginary part, then eigenvectors[:,i] is the real and eigenvectors[:,i+1] is the imaginary part of the eigenvector of the i-th eigenvalue. The eigenvalues are returned as a complex vector eigenvalues.

Example

  Modelica_LinearSystems2.StateSpace ss=Modelica_LinearSystems2.StateSpace(
    A=[-1,1;-1,-1],
    B=[1;1],
    C=[1,1],
    D=[0]);

  Real eigenvectors[2,2];
  Complex eigenvalues[2];

algorithm
  (eigenvectors, eigenvalues) = eigenVectors(ss, true);
// eigenvectors = [0.707, 0; 0, 0.707]
// eigenvalues = {-1 + 1j, -1 - 1j}

          |0.707 |         | 0.707 |
i.e. v1 = |      |,   v2 = |       |
          |0.707i|         |-0.707i|

Interface

function eigenVectors
  extends Modelica.Icons.Function;
  import Modelica.ComplexMath.j;
  input Real A[:, size(A, 1)] "Real square matrix";
  output Complex eigvec[size(A, 1), size(A, 2)] "Eigenvectors of the system";
  output Complex eigval[size(A, 1)] = fill(Complex(0), size(A, 1)) "Eigenvalues of the system";
end eigenVectors;

Generated at 2024-12-26T19:25:54Z by OpenModelicaOpenModelica 1.24.3 using GenerateDoc.mos