How can I get the same results between matlab svd and simulink svd?

Hi,
I've got a trouble with svd in simulink. Svd returns U S V, such that A= U S V'. The matrix U in the simulink svd, is different between U of the matlab svd (not only for the sign).
Why there is that difference?
How can i get the matrix U of the matlab svd from the U of simulink svd?

Answers (1)

From a numerical point of view, the reply of an SVD has to reply U, S and V such, that U*S*V' = A within certain rounding limits. In consequence different algorithms or order of executions will lead to different results, which are all "correct".
Now look at the differences of the results:
U_matlab - U_simulink
S_matlab - S_simulink
V_matlab - V_simulink
A - (U_matlab * S_matlab * V_matlab')
A - (U_simulink* S_simulink* V_simulink')
What do you observe?

7 Comments

I can't do U_matlab - U_simulink, because they are different in dimension. U_matlab is a m x m, U_sim could be a m x n. If both matrices are square, I don't understand the difference.
I know that is always verified A = U S V'. But I need to convert the U_simulink into U_matlab.
Does this mean, that the SVD in Simulink computes the "economy size" output? Then in Matlab: svd(A, 'econ')?!
Did the corresponding documentation reveal what's going on?
No, also with the economy size, matlab returns a different U. The first column is different in sign but not in magnitude, the second column is equal to simulink, the next columns are totally different.
When the Matlab SVD replies a [m x m], but Simulink [m x n], discussing about the contents of some columns is irrelevant.
I have explained already, that tiny differences in the input data can and will lead to different output. So what exactly is the problem? Considering numerical rounding effects, the SVD is not uniquely defined.
With the U of simulink, I obtain different and wrong result in the output of subspace tracking.
So your actual question is, that the SVD of Simulink is flawed? Or does this mean, that the substace tracking cannot handle a [m x n] matrix properly, e.g. because a length command is used instead of a size(x, 1)?
I still have no clue what you are talking about. I really want to help, but I can't.
I understand. In effect, what happens is strange. Simulink svd is not flawed, but is different from matlab. I don't know why, but the U matrix of simulink doesn't work good if I use it in my algorithm. Now I'm trying to write the svd code in a embedded matlab function, but is not easy for me. Svd function in matlab can't be edit, it's a build function, so I can't know the code.

Sign in to comment.

Asked:

max
on 13 Jan 2013

Community Treasure Hunt

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

Start Hunting!