function [U, S] = pca(X)
%PCA Run principal component analysis on the dataset X
%   [U, S, X] = pca(X) computes eigenvectors of the covariance matrix of X
%   Returns the eigenvectors U, the eigenvalues (on diagonal) in S
%

% Useful values
[m, n] = size(X);

% You need to return the following variables correctly.
U = zeros(n);
S = zeros(n);

% ====================== YOUR CODE HERE ======================
% Instructions: You should first compute the covariance matrix. Then, you
%               should use the "svd" function to compute the eigenvectors
%               and eigenvalues of the covariance matrix. 
%
% Note: When computing the covariance matrix, remember to divide by m (the
%       number of examples).
%

Sigma = (1 / m) * (X' * X);

[U , S , V] = svd(Sigma);






% =========================================================================

end

zhouxc
github-repos/MATLAB/zhouxc-Stanford-Machine-Learning-Course/Stanford-Machine-Learning-Course-cb1002771b33ac3af4a14be2afa0431212a66ea5/K-Means Clustering and PCA/mlclass-ex7/pca.m
Stanford-Machine-Learning-Course
github-repos/MATLAB/zhouxc-Stanford-Machine-Learning-Course
cb1002771b33ac3af4a14be2afa0431212a66ea5