S is diagonal matrix of singular values?
Ältere Kommentare anzeigen
Hi
I did {U,S,V)=svd(A)
when A is mxn
results: U is mxm, V is nxn, S is mxn (n> m)
S should be a diagonal matrix of singular values, the m singular values are diagonal location.
How ever, I use fprinf print ths S in a file as
fprintf(fids,[repmat('%8.4f\t',1,size(S,2)) '\n'],S);
Then I read this using a fotran code as
do k = 1, m
read(1,*) (s(k,j) j=1,n)
enddo
I found the singular values are not in diagonal. If this is corect, the U and V must re-agranged based on singular values, from large down to smaller. Why this did not in matlab. if not, what is the wrong with fprintf or svd. How we can make S to be realy a diagonal matrix?
Thanks
MK
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Operating on Diagonal Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!