-1

I want to do PCA on this 3D matrix:

data=[5 4 5; 5 3 0; 1 2 2];

PCA should return two components, like 3D to 2D, to plot the data on a graph.

What I've tried:

data=[5 4 5; 5 3 0; 1 2 2];
x= princomp(data');
x

But 'x' returns a 3D, instead of a 2D matrix.

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
tamaramaria
  • 173
  • 1
  • 4
  • 17

1 Answers1

1

I don’t think you have a 3D result. I think you have a result of dimension pxp when your data is nxp, which is normal. See the doc.

marsei
  • 7,691
  • 3
  • 32
  • 41