function [vc, vl] = vca(a)
% VCA  Calculate the eigensystem of the covariance matrix.
%
% Copyright (c) 1989-92 by The MathWorks, Inc.
%
%        VCA calculates the eigenvectors and eigenvalues of
%        the covariance matrix of an absorbance matrix.
%
%  [vc, vl] = vca(a)
%
% Where:
%
%  vc   is the matrix containing the eigenvectors (factors)
%  vl   is the column vector containing the eigenvalues
%  a    is the absorbance matrix
%
[vc, vl] = eig(a * a');
[vl, k] = sort(diag(vl));
vl = rot90(vl, 2);
k = rot90(k, 2);
vc = vc(:, k);
