How can I reproduce manually the random variables of the aPC function

2 visualizaciones (últimos 30 días)
Hello everyone. I am working with the PCA function. I am currently trying to do a manual version of the Karhunen-Loève expansion. Using PCA and data from realization_mat_merged I write:
[coeff, score, latent, tsquared, explained, mu]=pca(realization_mat_merged', 'Centered', false);
I can reproduce the scores by simply writing
C=cov(realization_mat_merged);
[U, d] = eig(C);
d = diag( d );
U= real(U);
d = real(d);
d = d(end:-1:1);
U = U(:,end:-1:1);
for 1=1:50
myScore(i)=sqrt(d(i))*U(:,i)
end
So, it is clear that the score is the eigenvector multiplied by the square root of the eigenvalue. Thus, the coeff is related to the random variable, which I have tried to reconstruct as
randVar=U'*realization_mat_merged';
However, the resulting matrix doesn't look at all like the coeff, so I don't know its relationship with the moment matrix of the covariance.
Can someone please tell me a way for me to reconstruct coeff by hand using the eigenvalues and-or eigenvectors of the covariance matrix of a stochastic process?
I am attaching a small sample of my code and data in case someone can help me.
Best regards.
Jaime.

Respuestas (0)

Categorías

Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by