PCA on square matrix

1 vue (au cours des 30 derniers jours)
Bashir Mohammad Sabquat Bahar Talukder
Modifié(e) : Bish Erbas le 26 Sep 2018
Let's see an example:
>>x = rand(4)
x =
0.8147 0.6324 0.9575 0.9572
0.9058 0.0975 0.9649 0.4854
0.1270 0.2785 0.1576 0.8003
0.9134 0.5469 0.9706 0.1419
>>coeff1=pca(x)
coeff1 =
0.6374 0.1376 -0.1798
0.1070 0.4092 0.9047
0.6684 0.2762 -0.1656
-0.3682 0.8587 -0.3490
>>coeff2 = pcacov(cov(x))
coeff2 =
0.6374 0.1376 -0.1798 0.7365
0.1070 0.4092 0.9047 0.0518
0.6684 0.2762 -0.1656 -0.6705
-0.3682 0.8587 -0.3490 0.0729
From my understanding, coeff1 and coeff2 should be the same. What is wrong here?

Réponse acceptée

Bish Erbas
Bish Erbas le 26 Sep 2018
Modifié(e) : Bish Erbas le 26 Sep 2018
x=rand(4);
c1=pca(x,'algorithm','eig','economy',false)
d1=pcacov(cov(x))
If you use the eig algorithm and set economy to false, outputs will be equal.
Reference:

Plus de réponses (0)

Catégories

En savoir plus sur Dimensionality Reduction and Feature Extraction dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by