ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

matrix inverse bug

Hi,
 
We are working with labview8 and the matrix inverse (at least the 4 by 4) differs from the result of matlab, is there something that I could be doing wrong?
0 Kudos
Message 1 of 8
(4,021 Views)
Do you have a matrix for which you get the wrong answer? I tried it with a few matrices and I was getting the same answer.
0 Kudos
Message 2 of 8
(4,011 Views)
You are using the "Inverse Matrix" primitive from the linear algebra palette, not the 1/x primitive of the numeric palette, right?
0 Kudos
Message 3 of 8
(4,006 Views)
here... thanks for the quick response!
0 Kudos
Message 4 of 8
(3,976 Views)
Hi macrom,

atleast the MathScript node gives the same result as the attachment shows...

Edited: changed the mathscript command from "a^-1" to "inv(a)" - both give the same result (within DBL precision).


Message Edited by GerdW on 07-03-2008 01:25 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 8
(3,970 Views)
Hi GerdW,

Thanks for the reply.

Im sorry I cant open the vi file, I only have the labview 8 and the file is saved as 8.5

I've tried the inverseMatrix.vi and the mathscript with both a^-1 and inv(a), all three are consistent with each other but still inconsistent with Matlab and Mathematica. A mathematician friend of mine said that it could be a numerical inestability of the algorithm. Has anyone heard of Labview having this problem? It could still be that its Matlab or Mathematica.

Anyway, I decided to use a matrix that works well in all the cases.

Thank you very much!!!




0 Kudos
Message 6 of 8
(3,953 Views)
Well, Mathscript is basically LabVIEW under the hood, so I don't expect them to be different.
 
How different are the results between LabVIEW and matlab?
 
I did some test and the LabVIEW version seems OK.
  1. If you take the inverse twice, you get the input matrix back within 1e-17.
  2. I also tried the scilab script node, the results differ from LabVIEW by about 1e-16, or about the precision of DBL. So clearly they use an entirely different algorithm, but give the same result!

 



Message Edited by altenbach on 07-03-2008 08:13 AM
0 Kudos
Message 7 of 8
(3,938 Views)
Hello macrom,

If it is just a small difference, it is most likely due to algorithmic differences.  Can you post the result matrix you get from your computation in the MATLAB® software?

MATLAB® is a registered trademark of The MathWorks, Inc.

Grant M.
Staff Software Engineer | LabVIEW Math & Signal Processing | National Instruments
0 Kudos
Message 8 of 8
(3,887 Views)