.Modelica_LinearSystems2.Math.Matrices.eigenValues

Information

Syntax

                eigenvalues = Matrices.eigenValues(A);
(eigenvalues, eigenvectors) = Matrices.eigenValues(A);

Description

This function call returns the eigenvalues and optionally the (right) eigenvectors of a square matrix A. The first column of "eigenvalues" contains the real and the second column contains the imaginary part of the eigenvalues. If the i-th eigenvalue has no imaginary part, then eigenvectors[:,i] is the corresponding real eigenvector. If the i-th eigenvalue has an imaginary part, then eigenvalues[i+1,:] is the conjugate complex eigenvalue and eigenvectors[:,i] is the real and eigenvectors[:,i+1] is the imaginary part of the eigenvector of the i-th eigenvalue. With function Modelica.Math.Matrices.eigenValueMatrix, a real block diagonal matrix is constructed from the eigenvalues such that

A = eigenvectors * eigenValueMatrix(eigenvalues) * inv(eigenvectors),

provided the eigenvector matrix "eigenvectors" can be inverted (an inversion is possible, if all eigenvalues are different and no eigenvalue is zero).

Example

  Real A[3,3] = [1,2,3;
                 3,4,5;
                 2,1,4];
  Real eval;

algorithm
  eval := Matrices.eigenValues(A);  // eval = [-0.618, 0;
                                    //          8.0  , 0;
                                    //          1.618, 0];

i.e., matrix A has the 3 real eigenvalues -0.618, 8, 1.618.

See also

Modelica.Math.Matrices.eigenValueMatrix, Modelica.Math.Matrices.singularValues

Interface

function eigenValues
  extends Modelica.Icons.Function;
  input Real A[:, size(A, 1)] "Matrix";
  output Real eigenvalues[size(A, 1), 2] "Eigenvalues of matrix A (Re: first column, Im: second column)";
  output Real leftEigenvectors[size(A, 1), size(A, 2)] "Real-valued eigenvector matrix";
  output Real rightEigenvectors[size(A, 1), size(A, 2)] "Real-valued eigenvector matrix";
end eigenValues;

Generated at 2024-11-23T19:25:52Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos