Singular Value Decomposition calculation of a matrix

2 visualizzazioni (ultimi 30 giorni)
I'm calculating the singular value decomposition of the following matrix A using the Matlab built-in function "svd":
A= [ 0 5 6; 8 9 4; 4 7 5];
"The result":
SVD_A = [16.8939733865235; 5.156904421786; 7.99007523366589e-16]
I tried chnaging the order of the rows in matrix A (by exchanging the 1st and 2nd column) to the following order and applied "svd" on B:
B= [ 8 9 4; 0 5 6; 4 7 5];
"The result":
SVD_B = [16.8939733865235; 5.156904421786; 9.8298029666369e-17]
I'm confused why is the last singular value in SVD vectors different although the two matrices are the same (only the order of the rows is different). How can I fix this issue?
Any help is appreciated!

Risposta accettata

James Tursa
James Tursa il 13 Set 2022
Modificato: James Tursa il 13 Set 2022
By changing the order of the rows you have changed the order of operations inside svd( ). The two answers are essentially the same, you simply got slightly different values for the number that is essentially 0 in the context of the problem. In general, changing the order of floating point operations is not guaranteed to give the exact same numeric result. You might read this link:
There is nothing to "fix" in the answers ... you just need to adjust your thinking to the realities of floating point operations and have appropriate code to handle these types of outcomes.

Più risposte (0)

Categorie

Scopri di più su Linear Algebra in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by