pca.m

% ------------------------------------------------------------------------
% Function: [pc,s,v,d,pr]=pca(x)
% ------------------------------------------------------------------------
% Aim:
% Principal Component Analysis by Singular Value Decomposition
% always on the smaller data dimension. 
% ------------------------------------------------------------------------
% Input: 
% x, matrix (n,p), data matrix n-objects, p-variables
% ------------------------------------------------------------------------
% Output:
% pc, matrix, contains in columns Principal Components
% s, matrix, contains in columns normalized scores
% v, vector, with eigenvalues
% d, matrix, contains in columns loadings 
% pr, vector, % of explained data variance by each PC
% ------------------------------------------------------------------------
% Example:
% [pc,s,v,d,pr]=pca(x)
% ------------------------------------------------------------------------
% Reference:
% [1] E.R. Malinowski, Factor analysis in chemistry, John Wiley & Sons, 
% INC., New York, 1991.
% [2] W. Wu, D.L. Massart, S. de Jong, The kernel PCA algorithms for wide 
% data. Part I: theory and algorithms, Chemometrics and Intelligent 
% Laboratory Systems 36 (1997) 165-172
Valid CSS! Valid HTML 4.01!