Home > NoiseTools > nt_pcarot.m

nt_pcarot

PURPOSE ^

[topcs,eigenvalues]=pcarot(cov,N) - PCA matrix from covariance

SYNOPSIS ^

function [topcs,eigenvalues]=nt_pcarot(cov,N)

DESCRIPTION ^

 [topcs,eigenvalues]=pcarot(cov,N) - PCA matrix from covariance

  topcs: PCA rotation matrix
  eigenvalues: PCA eigenvalues
  
  cov: covariance matrix

 NoiseTools

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [topcs,eigenvalues]=nt_pcarot(cov,N)
0002 % [topcs,eigenvalues]=pcarot(cov,N) - PCA matrix from covariance
0003 %
0004 %  topcs: PCA rotation matrix
0005 %  eigenvalues: PCA eigenvalues
0006 %
0007 %  cov: covariance matrix
0008 %
0009 % NoiseTools
0010 
0011 if nargin >1 && ~isempty(N); 
0012     [V, S] = eigs(cov,N) ;  
0013 else
0014     [V, S] = eig(cov) ;  
0015 end
0016 
0017 V=real(V);
0018 S=real(S);
0019 [eigenvalues, idx] = sort(diag(S)', 'descend') ;
0020 topcs = V(:,idx);
0021

Generated on Mon 10-Nov-2014 14:40:42 by m2html © 2005