11-04-2015 06:07 PM - edited 11-04-2015 06:10 PM
Hello all
I try to solve a system of linear equations AX = Y with LabVIEW 2015 student edition. I played around with the "Solve Linear Equations.vi" and the "Inverse Matrix.vi" from the linear algebra palette and found some strange behaviour. SLE gives results for a matrix with zero determinant (while it must not). for double check I also included the inverse matrix solution where it functions correctly. I'm super curious about why SLE gives such a result ( its seems quite unreliable to me right now) and what is the easiest solution for it.
Thanks
KGM
11-05-2015 03:03 AM
Please attach your VI with typical default data. We don't want to create test problems from scratch. Thanks.
11-05-2015 05:47 PM - edited 11-05-2015 05:55 PM
I have included the simple VI I was working with that day.
I want to solve 2x_1+3x_2+4x_3=7
2x_1+3x_2+4x_3=8
3x_1+5x_2+7x_3=4
Obviously it can not be solved becouse my first and second set of equations are the same with different results.
while SLE solves this and gives me x_1=16.4
x_2=3.47
x_3=-9.08
my coefficient matrix is
2 3 4
2 3 4
3 5 7
and my result matrix is
7
8
4
determinant of the coefficient matrix is zero and its condition number is too high but again I get an answer from that using SLE.
I have tried some other combinations and all lead to some results.
11-05-2015 06:05 PM
Did you read the Detailed Help file for the Solve Linear Equations.vi?
"Input Matrix is a square or rectangular, real matrix. The number of elements in the Known Vector must be equal to the rows of the Input Matrix. If the number of elements in the Known Vector does not match the rows of the Input Matrix, the VI sets the Solution Vector to an empty array and returns an error. When Input Matrix is singular, if the matrix type is General, the Solve Linear Equations VI finds the least-square solution. Otherwise, the VI returns an error."
Note the underlined sentence.
You may need to look at the condition number to get an idea of the validity of the solution. A value on the order of 1E16 is probably a clue that the "solution" involved dividing by something very close to zero.
Lynn