PCA on square matrix

2 次查看(过去 30 天)
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?

采纳的回答

Bish Erbas
Bish Erbas 2018-9-26
编辑:Bish Erbas 2018-9-26
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:

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Dimensionality Reduction and Feature Extraction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by