function [xpca xzca] = PCAwhite(x) size(x) x = x'; k= 10; epsilon=1e-42; avg = mean(x, 1) x = x - repmat(avg, size(x, 1), 1); sigma = x * x' / size(x, 2); size(sigma) [U,S,V] = svd(sigma); %xRot = U' * x; % rotated version of the data. %xTilde = U(:,1:k)' * x; % reduced dimension representation of the data, % where k is the number of eigenvectors to keep xpca = diag(1./sqrt(diag(S) + epsilon)) * U' * x; xzca = U * diag(1./sqrt(diag(S) + epsilon)) * U' * x; plot(x(