Error while Diagonalizing the Matrix

1 Ansicht (letzte 30 Tage)
Kang san Lee
Kang san Lee am 4 Jul. 2020
Beantwortet: Walter Roberson am 4 Jul. 2020
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.

Antworten (1)

Walter Roberson
Walter Roberson am 4 Jul. 2020
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

Kategorien

Mehr zu Eigenvalues & Eigenvectors finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by