Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

cwmatrix inversion VB6

Hello,

We are developping an application with matrix using VB6 SP4.
We use "Component Works 2.0.1" of National Instrument in order to use matrix functions.
So, in a Form we have added the component CWMatrix (rename CWMatrix1). We use it to make some operations :
  • Multiplications : CWMatrix.MatrixMul(x)
  • Inversion : CWMatrix.InvMatrix(x)
We have been able to use without any problem the multiplication function and we get the good results.
However we can't use correctly the inversion function because whatever is the input matrix, an error message tell us
that the matrix is singular and can't be reversed, whereas we put an input matrix which can be reversed.
We have tryed to use the function CWMatrix.Determinant(x) to calculate the determinant but whatever is the matrix, the result is always 0.

We can see a part of our code :

    'Matrix Déclaration in the top of the Form
    Private MatricePassageGlobale() As Double 'Matrice de passage globale
    Private MatricePassage2() As Double 'Matrice de passage
    Private MatricePassage3() As Double 'Matrice de passage

    'Matrix redimensioning
    ReDim MatricePassageGlobale(3, 3)
    ReDim MatricePassage2(3, 3)
    ReDim MatricePassage3(3, 3)

    'Code
      MatricePassage2(1, 1) = 1
      MatricePassage2(2, 2) = 1
      MatricePassage2(3, 3) = 1
     
      MatricePassage3(1, 1) = 2
      MatricePassage3(2, 2) = 2
      MatricePassage3(3, 3) = 2
     
      MatricePassageGlobale = CWMatrix1.MatrixMul(MatricePassage2, MatricePassage3)
     
      'Results checking
      MsgBox "1,1= " & MatricePassageGlobale(1, 1)
      MsgBox "1,2= " & MatricePassageGlobale(1, 2)
      MsgBox "1,3= " & MatricePassageGlobale(1, 3)
      MsgBox "2,1= " & MatricePassageGlobale(2, 1)
      MsgBox "2,2= " & MatricePassageGlobale(2, 2)
      MsgBox "2,3= " & MatricePassageGlobale(2, 3)
      MsgBox "3,1= " & MatricePassageGlobale(3, 1)
      MsgBox "3,2= " & MatricePassageGlobale(3, 2)
      MsgBox "3,3= " & MatricePassageGlobale(3, 3)

      'Determinant display
      MsgBox "det = " & CWMatrix1.Determinant(MatricePassageGlobale)

      'Matrix inversion
      MatricePassageGlobale = CWMatrix1.InvMatrix(MatricePassageGlobale)

On the line of the inversion, an error message occured :

Erreur d'exécution '20041'
The Syteme of equations cannot be solved because the input matrix is singular

Could you help us to solve this problem please ?
Thank a lot if you have read our message and if you can answer

Julien
0 Kudos
Message 1 of 2
(6,512 Views)

Have a look on the following forum:

http://forums.ni.com/ni/board/message?board.id=170&message.id=57289&requireLogin=False

Hope this helps.

Omar S. NI

0 Kudos
Message 2 of 2
(6,489 Views)