Singular Value Decomposition calculation of a matrix

조회 수: 1 (최근 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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by