I try to calculate the PCA in my matrix and I use two ways for this:
[coeff, score, eigenvalues] = pca(M);
And for compare and understand the PCA calculus, I try to calculate step by step the PCA without the matlab function pca.
%// first I "z-scored" my matrix X = zscore(M); %// second I calculate the covariance matrix %// this matrix is equals to the correlation matrix V = cov(X); %// Third, I calculate the eigenvalues(E) and eigenvectors(U) [U,E] = eig(V);
pca function's eigenvalues are not equal to
E and I think the columns of
U are principal components and rows of
U are variables and it's not equal to
So, I think that I don't understand how calculate the PCA of a matrix?