Error while Diagonalizing the Matrix

3 ビュー (過去 30 日間)
Kang san Lee
Kang san Lee 2020 年 7 月 4 日
回答済み: Walter Roberson 2020 年 7 月 4 日
I'm studying State Space function thesedays, and made a code below
A = [ 0 1 0; 0 0 1; -6 -11 -6];
P = [ 1 1 1; -1 -2 -3; 1 4 9 ];
S = P^(-1);
A1 = S*A*P;
Expected answer was
A1 = [ -1 0 0 ; 0 -2 0 ; 0 0 -3 ]
because of the eigenvalue process, however, it made a conclusion as
A1 = [ -1, -1.7764e-15, -2.6645e-15 ; 2.6645e-15, -2, 7.1054e-15 ; -1.3323e-15, -2.6645e-15, -3 ]
And other variables are calculated just as I expected.
I don't know what makes this kind of error and how can I solve it?
It can be a critical error in the process.

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 7 月 4 日
Do not use P^(-1), which is also known as inv(P), if you can avoid doing so. The calculations have too much numeric difficulty.
Use the \ or / operator insted.
A1 = P\A*P
The answer will not be the exact integers you are expecting, but it will be closer to what you are expecting.
If you need exact values then do not work numerically, work symbolically:
A1 = P\sym(A)*P

カテゴリ

Help Center および File ExchangeEigenvalues & Eigenvectors についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by