Re: Help with SVDC procedure [message #82963] |
Tue, 29 January 2013 04:33 |
fd_luni
Messages: 66 Registered: January 2013
|
Member |
|
|
>> You say that the values you get for X are not what you expected. But I would try it the other way around. Does the value of X you get solve the equation, Ax = B, correctly? If it does, then you found *a* solution to the equation, even if it is not the one you expected.
Yes, the values of X that I get solve the equation, Ax=B.
>> Also, as a matter of efficiency, your SV matrix is diagonal. Thus you can just compute SVinv = 1/SV rather than using INVERSE().
I tried to what you suggested me SVinv = 1/SV rather than using INVERSE() and I've got the following error.
"Program caused arithmetic error: Floating divide by 0"
P.S. I am using IDL few weeks ago that's why I am asking a lot of things
|
|
|
Re: Help with SVDC procedure [message #82968 is a reply to message #82963] |
Mon, 28 January 2013 18:45  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Monday, January 28, 2013 4:24:44 PM UTC-5, fd_...@mail.com wrote:
> Hi
>
>
>
> I am trying to solve a matrix system with SVD method. Ihave the following arrays: A( 100 rows by 4 columns), X (4 rows by 1 column) and B (100 rows by 1 column). The form of the system is Ax=B. I used the Linear Least Squares and get the form x= V invert(SV) transpose(U)B (based on SVD procedure in IDL). The problem is that the 4 values that I get for the array x are not what I expected. I used the same method, same commands but with simpler arrays and it works. Why this doesn't work for my arrays??
...
You say that the values you get for X are not what you expected. But I would try it the other way around. Does the value of X you get solve the equation, Ax = B, correctly? If it does, then you found *a* solution to the equation, even if it is not the one you expected.
You are claiming to do least squares so no solution will solve the system precisely, but you can test to see which solution (your expected solution or your obtained solution) has smaller errors.
Also, as a matter of efficiency, your SV matrix is diagonal. Thus you can just compute SVinv = 1/SV rather than using INVERSE().
CM
|
|
|