Why I'm getting different result while performing PCA with pca and princomp?

[c,s,l] = princomp(x);
[c,s,l] = pca(X);
% First Command returns with complete i*j but Second returns i*(j-1).

Answers (1)

Hi Hitesh,
I understand that you are facing issues with PCA and PRINCOMP.
  • Use pca: It is the recommended method for PCA in MATLAB, offering better performance and more options.
  • Check Data: Ensure your data is well-prepared and free of NaNs unless you are using options to handle them.
  • Understand Output: Be aware of the default behavior regarding the number of components returned, and adjust using options if necessary.

Categories

Tags

No tags entered yet.

Asked:

on 4 Sep 2015

Answered:

on 31 Jan 2025

Community Treasure Hunt

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

Start Hunting!