Hi everyone. Sorry but I am very new to Matlab. The data I am working with has 10 variables and 31 observations. The 11th column is one of two categories to which each of these observations belong. I am using PCA to determine which of these 10 variables are most influential (or responsible for the most variance). I would like to get a 3D plot of the first 3 Principal components. Please, see below my script for this task.
[coeff,score,latent,tsquared,explained,mu] = pca(Values(:,1:10), 'NumComponents', 10)
y = Values(:,11);
scatter3(Values(:,1),Values(:,2),Values(:,3), 20, y, 'filled')
xlabel('1st Principal Component')
ylabel('2nd Principal Component')
zlabel('3rd Principal Component')
Note: I imported the observations from a csv file as “Values” (49x11) and the variables as “Parameters” (1x11).
Below is what the above script produces:
I was hoping to get the points for the various variables in the plot in different colours to be able to tell which variable is where. At the moment it’s only the two categories that have been colour coded and not the variables. I hope there is a way to get these variables colour coded.I would appreciate it very much if I could get the correct script for this. Thanks a lot in advance.