Main Content

ordeig

Eigenvalues of quasitriangular matrices

Syntax

E = ordeig(T)
E = ordeig(AA,BB)

Description

E = ordeig(T)takes a quasitriangular Schur matrixT, typically produced byschur, and returns the vectorEof eigenvalues in their order of appearance down the diagonal of T.

E = ordeig(AA,BB)takes a quasitriangular matrix pairAAandBB, typically produced byqz, and returns the generalized eigenvalues in their order of appearance down the diagonal ofAA-λ*BB.

ordeigis an order-preserving version ofeigfor use withordschurandordqz. It is also faster thaneigfor quasitriangular matrices.

Examples

Example 1

T=diag([1 -1 3 -5 2]);

ordeig(T)returns the eigenvalues ofTin the same order they appear on the diagonal.

ordeig(T) ans = 1 -1 3 -5 2

eig(T), on the other hand, returns the eigenvalues in order of increasing magnitude.

eig(T) ans = -5 -1 1 2 3

Example 2

A = rand(10); [U, T] = schur(A); abs(ordeig(T)) ans = 5.3786 0.7564 0.7564 0.7802 0.7080 0.7080 0.5855 0.5855 0.1445 0.0812 % Move eigenvalues with magnitude < 0.5 to the % upper-left corner of T. [U,T] = ordschur(U,T,abs(E)<0.5); abs(ordeig(T)) ans = 0.1445 0.0812 5.3786 0.7564 0.7564 0.7802 0.7080 0.7080 0.5855 0.5855

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a