mean = [5;5;10];
sigma = [6 -3 0; -3 6 0; 0 0 10];
no_of_samples = 100000;
samples = mvnrnd(mean, sigma, no_of_samples);
covariances = cov(samples);
[v, D, W] = eig(covariances);
v(:,1)
D(1,1)
v(:,2)
D(2,2)
v(:,3)
D(3,3)
% alternatively
[coeff, scores, latent ] = pca(samples)
coeff % columns are pca basis
latent % eigenvals
Created
April 27, 2017 18:41
-
-
Save madratman/84cb19faccf0dc13f75c2139c7d9736d to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment