07-20-2018 08:14 AM - edited 07-20-2018 08:18 AM
plots.vi and maha_dist.vi are still missing,
also lots of broken wires in pca.vi
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.
07-20-2018 08:25 AM
Please find the updated attachment.
07-23-2018 12:40 AM
Please reply...
07-23-2018 02:22 PM
I ran your code "pca.vi". 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
07-23-2018 05:01 PM
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:
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
07-24-2018 12:48 AM
Actually, I have named it cov_mat.vi, but it is actually a correlation matrix.