2019-11-30 15:55:43 +00:00
|
|
|
function E=getEigenModel(obs)
|
2019-11-29 19:33:07 +00:00
|
|
|
|
2019-11-30 15:55:43 +00:00
|
|
|
E.N = size(obs,1);
|
|
|
|
E.D = size(obs,2);
|
|
|
|
E.org= mean(obs);
|
2019-11-29 19:33:07 +00:00
|
|
|
|
2019-11-30 15:55:43 +00:00
|
|
|
obs_translated=obs-repmat(E.org,E.N,1);
|
2019-11-29 19:33:07 +00:00
|
|
|
|
2019-11-30 15:55:43 +00:00
|
|
|
C=(1/E.N) * (obs_translated' * obs_translated);
|
2019-11-29 19:33:07 +00:00
|
|
|
|
2019-11-30 15:55:43 +00:00
|
|
|
[U V]=eig(C);
|
|
|
|
|
|
|
|
% sort eigenvectors and eigenvalues by eigenvalue size (desc)
|
|
|
|
linV=V*ones(size(V,2),1);
|
|
|
|
S=[linV U'];
|
|
|
|
S=flipud(sortrows(S,1));
|
|
|
|
U=S(:,2:end)';
|
|
|
|
V=S(:,1);
|
|
|
|
|
|
|
|
E.vct=U;
|
|
|
|
E.val=V;
|
2019-11-29 19:33:07 +00:00
|
|
|
|
|
|
|
return;
|