Showing results for 
Search instead for 
Did you mean: 

eigenvalues and vectors and are still missing,

also lots of broken wires in


one thing i saw immediately .. it's mostly cosmetic, but if you want to have an array [0,1,2,...,n] you just use the 'i' in the for loop, that does exactly what you try to do with  +1 and shift register. to have your array start with 1 instead of 0, either have the +1 in the for loop, or use a "Array Subset" or "Split Array" starting at index 1.


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 11 of 27

Please find the updated attachment. 

0 Kudos
Message 12 of 27

Please reply...

0 Kudos
Message 13 of 27

I ran your code "".  I assume you know you didn't wire any of the outputs, so you might not know that the first computation (for "Normal") gives Error -20068, "Input parameters has at least one element that is Inf, NaN, DBL_MAX, or DBL_MIN".  The other two computations do give numbers, don't know what to make of them ...


Since you seem to be worried about whether or not you are able to compute Eigenvalues and Eigenvectors from your data, why don't you create a small (10 x 10?  3 x 3?) set of data whose EigenThings you know and see if LabVIEW (and/or Matlab) gives you the expected results.


Bob Schor

0 Kudos
Message 14 of 27

Hmm.  I decided to try what I suggested (take known data and see if LabVIEW computes correctly) myself.  I've not played with these kinds of data analysis functions in LabVIEW (I've not done much with LabVIEW's Matrix types), so it was a "learning experience".


Here's what I did:

  • Generated 5000 points with X, Y normally distributed, N(0, 1).
  • Scaled X by 4.  Rotated the sample by 30°.
  • The largest Eigenvalue should be the variance along the direction of maximum spread, and the corresponding Eigenvector should point in this direction.  This suggests that the Eigenvalues should be 16 (variance of N(0, 4)) and 1, with the Eigenvectors pointing at 30° and 120°.
  • Computed Covariance Matrix had main diagonals of 11.8 and 4.6, with off-diagonals of 6.25.
  • The computed Eigenvalues were 15.4 and 0.99.  The larger Eigenvector had components of 0.865 and 0.502, reasonably close to cos(30°) and sin(30°).

My conclusion is that LabVIEW's computation is likely to be mathematically correct.  Whether or not you are doing "the math correctly" or not, I'm not sure.  I will tell you that my code has no explicit square-root function in it.  If I had to guess, I'd guess you are not correctly computing the covariance matrix.  [Could you have gotten "correlation" and "covariance" mixed up?  Is that where the square root comes in?].


Bob Schor

0 Kudos
Message 15 of 27

Actually, I have named it, but it is actually a correlation matrix. 

0 Kudos
Message 16 of 27

@canzie07 wrote:

Actually, I have named it, but it is actually a correlation matrix. 

Ah, so you deliberately did the wrong math, and got the wrong result.  Problem solved!


Bob Schor

0 Kudos
Message 17 of 27

No. I have to calculate the correlation matrix but by mistake named it which you understood as covariance. With this VI, I have got the correct result as gotten by Matlab software. But eigenvalue and vector function used from both the software is giving the different result.


That is my doubt.

0 Kudos
Message 18 of 27

Hi canzie,


both the software is giving the different result.

So after several days I ask again: how much do the results differ?

Best regards,

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 19 of 27

I haven't calculated the difference but the values are not the same everytime I run the program from both the software.

0 Kudos
Message 20 of 27