07-24-2018 07:19 AM
i think gerd's question was to make sure, that its not a miniscule difference,
coming from the different implementations of the algorithms in matlab/labview.
as a way to verify your algorithm, implement a mockup, with a defined small input matrix, for which you can even calcuclate/verify by hand and compare this with matalab.
describing what you want to do in a mathematical way might also be helpful.
so it may become easier to verify the correctness of your labview algorithm.
regards
07-24-2018 03:05 PM
I did the following experiment (which I invite you to do, as well):
Quoting from "What does eigenvalues expres in the covariance matrix" (not my spelling!) question in the Matlab Forums, "observe the eigenvalues of the covariance matrix are equal to the variance of the data's coordinates".
When I calculate the Eigenvalues of the Covariance matrix, I get the Variance of the data's coordinates, which is what the Matlab Forum suggests should be expected. When you calculate something related to the Correlation (not Covariance) matrix, you get something else. This does not say anything about Matlab's or LabVIEW's Eigenvalue functions.
Bob Schor
07-25-2018 07:25 AM
@canzie07 wrote:
the command for eigenvalues and vectors of the single matrix gives the different result when compared with the Matlab command for the same. please solve the doubt.
I'm not commenting on the science behind the experiment, but of the OP's original question, that the results are not the same between LabVIEW and Matlab. I'm not a mathematician nor expert in Linear Algebra but here is what I think is going on.
I compared the results for several 3x3 matrices, and shown here is a snippet of the results for the OP's "all_nor325_25_600" file using LabVIEW and Matlab.
The results for each column are the same up to 15 significant digits with the following 2 exceptions:
1. The sort order of the eigenvector/eigenvalue pairs are not the same. It appears that LabVIEW sorts the pairs by decreasing eigenvalues, and Matlab sorts them by increasing eigenvalues.
2. Some of the eigenvector columns are scaled by a factor of -1.
My understanding is that the eigenvector is a column vector, and each eigenvector is paired with its corresponding eigenvalue. There is no implied sort order for the complete set of eigenvector/eigenvalue pairs. They all satisfy the equation A*x = lamda*x. Changing the sign of each element of an eigenvector has the same effect as multiplying both side of the equation by -1 so the relationship for a linear system still is true (-A*x = -lambda*x). I believe is would also be true for ANY constant scale factor for the eigenvectors.
The bottom line is that the OP is indexing the eigenvector matrix to a specific column in his LabVIEW vi. That column is most likely not the same as the column in the Matlab matrix.
08-03-2018 05:44 AM
Thank you very much. You have understood my problem.
08-10-2018 12:59 PM
I haven't understood properly.But please help me find some solution.It's very urgent.
08-13-2018 12:20 AM - edited 08-13-2018 12:21 AM
Hi canzie,
I haven't understood properly.
What exactly didn't you understand?
But please help me find some solution.
See message #23 for a solution!
It's very urgent.
Well, nearly 3 weeks after the solution was presented: can't be that urgent…
08-13-2018 07:29 AM
Canzie,
I have tried to convince you that LabVIEW is returning the correct answers to the problem of finding the Principle Components of a set of covarying data, sorted with the largest Component first (makes sense to me!). I don't have Matlab currently available, so was unable to confirm that Matlab produced the same results with this data.
GerdW did a direct LabVIEW-to-Matlab comparison, and seemed to find that both systems gave the same results (to within rounding errors), but perhaps in different orders and/or with the sign of the Eigenvector components reversed (which doesn't change the math).
So why are you still asking questions? It appears that LabVIEW and Matlab give the same results, but may format them differently, may have confused you by their computation conventions, etc. As GerdW says, it's been three weeks that this "urgent" problem has been bugging you, but the answer seems to be "there's no problem here, only one of perception". If you still don't get it, go find your instructor, show him/her this Forum conversation, and say "I still don't get it, please help me understand" ...
Bob Schor