PCA on square matrix

조회 수: 2 (최근 30일)
Bashir Mohammad Sabquat Bahar Talukder
편집: Bish Erbas 2018년 9월 26일
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