Not able to correct the sign of computed SVD.

2 次查看(过去 30 天)
I am trying to check the working of Matlab's SVD by correcting the sign of the computed SVD.
Step 1: I am creating an A matrix from random U,S and V' ;
Step 2: I am calculating the svd(A) and finding subsequent U2,S2 and V2'
Step 3: Next up I am comparing the U, V and A by taking the norm of their difference!
Step 4: Correction step; I am multiplying the computed U2, V2 with appropriate sign changes such that they get back to the original sign convention.
Step 5: I am again comparing them with original U,V and A in N4,N5 and N6!
The U matrix is getting corrected but the V and A matrix is still showing error of high orders! Can anyone help me with this!
Thanks!
U = rand(50);
V = rand(50);
d = rand(50,1);
s = sort(d);
S = diag(d);
A = U*S*(V)'; % Compute A matrix from U, S, V
[U2,S2,V2]= svd(A); % Compute SVD of A
A2 = U2*S2*(V2)';
N1=norm(U2-U);
N2=norm(V2-V);
N3= norm(A2-A);
D = ((U2')*U); % Converting to diagonal matrix for plotting only
D2 = ((V2')*V);
A3 = (U2*D)*S2*(D2*V2)';
N4=norm(U2*D-U);
N5=norm(D2*V2-V);
N6 = norm(A3-A);
  5 个评论
Torsten
Torsten 2022-10-10
Did you ask google ? There are so many hits for "matlab & generate unitary matrix".
Anshuman
Anshuman 2022-10-10
Naah, I figured it out from my linear algebra class! Thanks!

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Eigenvalues 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by