How to identify repeated eigenvalues of a matrix?

6 ビュー (過去 30 日間)
Mohammad Ayoub
Mohammad Ayoub 2018 年 4 月 16 日
コメント済み: Mohammad Ayoub 2018 年 4 月 21 日
Take the matrix A as an example:
A = [1 1 0 0;0 1 1 0;0 0 1 0;0 0 0 3]
The eigenvalues of A are: 1,1,1,3. How can I identify that there are 2 repeated eigenvalues? (the value 1 repeated two times)
Thank you in advance.

採用された回答

Aditya Deshpande
Aditya Deshpande 2018 年 4 月 17 日
編集済み: Aditya Deshpande 2018 年 4 月 17 日

You can find the number of times an eigen value is repeated as follows.

A = [1 1 0 0;0 1 1 0;0 0 1 0;0 0 0 3];
E = eig(A);
u = unique(E);
R = histc(E,u)-1;

Output is:

E =
     1
     1
     1
     3
u =
     1
     3
R =
     2
     0

NOTE: if R(i) = 0, eigen value is not repeated, but has occurred only once in vector E.

その他の回答 (1 件)

Christine Tobler
Christine Tobler 2018 年 4 月 17 日

For general matrices, the eigenvalues will typically have a bit of round-off error, so repeated eigenvalues will not be exactly identical. In those cases, you should use uniquetol instead of just unique in the algorithm proposed by Aditya.

  1 件のコメント
Mohammad Ayoub
Mohammad Ayoub 2018 年 4 月 21 日
Thank you very much for pointing that out.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by