Hi A,
To apply Principal Component Analysis (PCA) using MATLAB's princomp (or the updated pca function), and then transform your original data into a reduced-dimensionality space, follow these steps:
% Assume your data matrix is named 'dataMatrix' with size 10000x500
[coeff, score, latent, tsquared, explained, mu] = pca(dataMatrix);
cumulativeVariance = cumsum(explained);
plot(cumulativeVariance);
xlabel('Number of Principal Components');
ylabel('Cumulative Explained Variance (%)');
% Choose the number of components to keep
k = 50; % for example, keep the first 50 components
% Transform the original data
reducedData = score(:, 1:k);
% Reconstruct the data from the reduced dimensions
reconstructedData = reducedData * coeff(:, 1:k)' + mu;