0

i try to implement the same matrix F to the svd function on both versions of matlab. However, i found out that sign of U and V matrix from both solutions are opposite. May i know which versions of MATLAB provide a better or more accurate answer? or actually both answers are correct?

Amro
  • 123,847
  • 25
  • 243
  • 454
kenneth
  • 167
  • 2
  • 10
  • 1
    Both answers are correct and as good as each other. The sign is often different between implementations. See http://stackoverflow.com/questions/5935893/any-reason-why-octave-r-numpy-and-lapack-yield-different-svd-results-on-the-sa http://stackoverflow.com/questions/16053380/svd-computing-different-result-in-matlab-and-opencv and http://www.mathworks.com.au/matlabcentral/newsreader/view_thread/297670 – Bull Jun 05 '13 at 08:43

1 Answers1

1

The singular value decomposition of a matrix is only defined up to a sign, so the signs of U and V are arbitrary, and both answers are correct. Whichever signs MATLAB produces, it should still be the case that F = U*S*V, so U and V constitute a correct singular value decomposition of F. (Note "a", not "the").

You shouldn't rely on MATLAB producing particular signs, and it may vary from version to version.

Sam Roberts
  • 23,951
  • 1
  • 40
  • 64