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

1 回表示 (過去 30 日間)
Jaime De La Mota Sanchis
Jaime De La Mota Sanchis 2022 年 5 月 8 日
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.

回答 (0 件)

カテゴリ

Help Center および File ExchangeDimensionality Reduction and Feature Extraction についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by