Skip to content

Instantly share code, notes, and snippets.

@lettergram
Last active August 29, 2015 14:17
Show Gist options
  • Save lettergram/d5ec3970ac4aa4f3e30d to your computer and use it in GitHub Desktop.
Save lettergram/d5ec3970ac4aa4f3e30d to your computer and use it in GitHub Desktop.
PCA Function
% Find score matrix for PCA %
% Outputs score between column s and e %
function W = PCA(matrix, s, e)
[U,S,V] = svd(matrix * transpose(matrix));
T = U * sqrt(S);
T = W(:,s:e);
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment