SVD issue calculating null basis
Mostrar comentarios más antiguos
I am tyring to reproduce the image results for V. I have written the following code. However, the V produced by svd command is not matching what I should see. I have double checked my G matrix and the S output is correct. Any advice appreciated.
%create the matrix, run svd
G=[1 0 0 1 0 0 1 0 0; 0 1 0 0 1 0 0 1 0; 0 0 1 0 0 1 0 0 1; 1 1 1 0 0 0 0 0 0;
0 0 0 1 1 1 0 0 0; 0 0 0 0 0 0 1 1 1; sqrt(2) 0 0 0 sqrt(2) 0 0 0 sqrt(2); 0 0 0 0 0 0 0 0 sqrt(2)];
[U,S,V] = svd(G,0);
s_d=diag(S);
%The model null space, N(G), is spanned by the two orthonormal vectors
%that form the 8th and 9th columns of V. An orthonormal basis for the null space is
s = diag(S);
column_basis = U(:,logical(s));
rank_G= nnz(s);
null_basis=V(:,~s);

3 comentarios
Walter Roberson
el 25 de Mzo. de 2019
Editada: Walter Roberson
el 25 de Mzo. de 2019
rank(G) shows 7.
You are using a proxy for the rank when you look at the number of nonzeros of the diagonal. As they discuss, there is numeric noise in one of the elements.
L
el 25 de Mzo. de 2019
L
el 25 de Mzo. de 2019
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Sparse Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!