I'm trying to apply pca() function on 3d data, But I'm getting empty COEFF matrix
x1 = randn(400,1);
y1 = randn(400,1);
z1 = randn(400,1);
plot3(x1,y1,z1,'r.');
[COEFF] = pca([x1;y1;z1]')

 채택된 답변

Jason Millen
Jason Millen 2016년 8월 16일
편집: Jason Millen 2016년 8월 16일

0 개 추천

The reason you are getting an empty 1200-by-0 matrix is because you are passing a 1-by-1200 matrix to pca.
I believe what you want to do is pass it a 400-by-3 matrix, which can be accomplished with [x1';y1';z1']'. Thus, if you call pca([x1';y1';z1']'), you will get a 3-by-3 coefficient matrix.
If you would like to read up more on the documentation for pca(), you can find it here.

댓글 수: 3

Walter Roberson
Walter Roberson 2016년 8월 16일
The user is passing a 1200 x 1 matrix to pca.
Jason Millen
Jason Millen 2016년 8월 16일
I believe there is a transpose operator given before the matrix is passed into pca, making it 1-by-1200. Please correct me if I am wrong.
Walter Roberson
Walter Roberson 2016년 8월 16일
Ah, you are correct, I missed that.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Dimensionality Reduction and Feature Extraction에 대해 자세히 알아보기

질문:

2016년 8월 11일

댓글:

2016년 8월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by