直接上代码!
% pca和白化
function features_pca_white = pca_and_whiting(feature,a)features=zscore(feature);[~,score,~] = pca(features);features_pca = score(:,1:a);x=features_pca';sigma=(x*x')/size(x,2);[u,s,~]=svd(sigma);xRot = zeros(size(x));xRot=u'*x;epsilon = 1e-5;xPCAWhite=size(x);xPCAWhite=diag(1./(sqrt(diag(s)+epsilon)))*xRot;features_pca=xPCAWhite';features_pca_white = normalize(features_pca,2,'zscore');
end