Singular Value Decomposition calculation of a matrix

2 ビュー (過去 30 日間)
HN
HN 2022 年 9 月 13 日
コメント済み: HN 2022 年 9 月 15 日
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!

採用された回答

James Tursa
James Tursa 2022 年 9 月 13 日
編集済み: James Tursa 2022 年 9 月 13 日
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.
  1 件のコメント
HN
HN 2022 年 9 月 15 日
Got it, thank you for your reply!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by