📄 truepca.m
字号:
function [evects,evals] = truepca(dataset)% [evects,evals] = truepca(dataset)%% USUAL WAY TO DO PCA -- find sample covariance and diagonalize%% input: dataset % note, in dataset, each COLUMN is a datapoint% the data mean will be subtracted and discarded% % output: evects holds the eigenvectors, one per column% evals holds the corresponding eigenvalues%[d,N] = size(dataset);mm = mean(dataset')';dataset = dataset - mm*ones(1,N);cc = cov(dataset',1);[cvv,cdd] = eig(cc);[zz,ii] = sort(diag(cdd));ii = flipud(ii);evects = cvv(:,ii);cdd = diag(cdd);evals = cdd(ii);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -