Error while Diagonalizing the Matrix

1 visualización (últimos 30 días)
Kang san Lee
Kang san Lee el 4 de Jul. de 2020
Respondida: Walter Roberson el 4 de Jul. de 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.

Respuestas (1)

Walter Roberson
Walter Roberson el 4 de Jul. de 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

Categorías

Más información sobre Eigenvalues & Eigenvectors en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by