[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Principal component analysis
From: |
Ted Harding |
Subject: |
Re: Principal component analysis |
Date: |
Thu, 15 May 1997 20:02:01 +0100 (GMT+0100) |
( Re Message From: Tom Goles )
>
> Hi,
> Does anyone know if there are octave functions/libraries
> that do PCA (principal component analysis)?
> Any info on this is greatly appreciated.
> Thanks,
> Tomislav Goles
All you really need is the following very basic routine. The rest (what
you supply it with, and what you do with the output) is up to you.
Best wishes,
Ted. (address@hidden)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
function [V,v] = princomp(X)
# Given a (covariance or correlation) matrix X, returns
# V = matrix whose columns are the eigenvectors of X, corresponding to
# v = vector of eigenvalues of X, in decreasing order of size.
[V,v] = eig(X); [v,S] = sort(-diag(v)); V = V(:,S); v = -v;
endfunction