Why do I see a singular matrix warning here?
32 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
John D'Errico
am 22 Okt. 2021
Kommentiert: Clara Casado-Coterillo
am 23 Okt. 2023
I've posted this question as a "response" to a question posed by someone else, but as an answer to another question. Since I cannot move that answer into a question by that person, I'll post the question myself, since this seems to be a question I have seen too often.
A = [2 1 -5; 0 1 -2; 0 0 2];
[V, D] = eig(A);
% Matrix of eigenvectors returned
V
% Eigenvalues for those eigenvectors
diag(D)
% But now, when I try to recover A from the eigenvalues and eigenvectors,
% this fails, and I get a singular matrix warning? Why is that?
V\D*V
Even worse, the result does not reproduce A? What is wrong with eig?
A
1 Kommentar
Clara Casado-Coterillo
am 23 Okt. 2023
when a jacobian in nlparci gives back this warning in nlparci, what should we do?
Akzeptierte Antwort
John D'Errico
am 22 Okt. 2021
Bearbeitet: John D'Errico
am 22 Okt. 2021
8 Kommentare
Christine Tobler
am 22 Okt. 2021
Great post, John! I just wanted to point out two MATLAB functions that can be used to check if a matrix is defective.
If you're using the symbolic toolbox, calling eig on a symbolic matrix will tell you this exactly: V only contains linearly independent eigenvectors, while D gives the multiplicities of each eigenvalue. The third output P can be used to map from the eigenvalues in D to the eigenvectors in P.
A = [2 1 -5; 0 1 -2; 0 0 2];
[V, D, P] = eig(sym(A));
V
diag(D)
P
If we're doing numeric computations, "is this matrix defective" can't be answered easily, because any tiny change to the matrix would change the answer. This is similar to the question of "is this matrix low-rank" - adding some tiny random noise will make the matrix be full-rank in exact arithmetic, but when doing numerical computations, we would want to know if the matrix is close up to round-off to a low-rank matrix.
So here also, we can answer the question "is this matrix close to being defective". In a way, the warning about U being ill-conditioned was already doing that, telling us that the eigenvectors found are close to being linearly dependent.
Some more detailed information is given by condeig:
[U, D, s] = condeig(A);
diag(D)
log10(s)
Each value in s gives the sensitivity of the corresponding eigenvalue towards a small change in A. If s(i) is very large it means that the matrix A is close to a matrix for which this i'th eigenvalue "is defective" (that is, that it has larger algebraic than geometric multiplicity).
Bruno Luong
am 23 Okt. 2021
Bearbeitet: Bruno Luong
am 23 Okt. 2021
"But does the form Vb\Db*Vb recover B?"
Actually Vb*Db/Vb recovers B
B=[2 1 -5
0 1 -2
0 0 3]
[Vb,Db] = eig(B)
Br = Vb*Db/Vb
norm(Br - B)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Linear Algebra 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!