getshapestatistics.m
来自「asm工具箱」· M 代码 · 共 27 行
M
27 行
%%%%%%%%%%%%%%%%%%%%%%%%%%
%(c) Ghassan Hamarneh 1999
%%%%%%%%%%%%%%%%%%%%%%%%%%
function [MeanShape,tEigenvectors,tEigenValues]=GetShapeStatistics(Xa,ExplainPercent);
%function [MeanShape,tEigenvectors,tEigenValues]=GetShapeStatistics(Xa,ExplainPercent);
MeanShape=(sum(Xa'))'/size(Xa,2);
%DX=Xa-MeanShape*ones(1,size(Xa,2));
%CovMatrix=zeros(size(Xa,1),size(Xa,1));
%for ind1=1:size(Xa,2),
% CovMatrix=CovMatrix+DX(:,ind1)*DX(:,ind1)';
%end
%CovMatrix=CovMatrix/size(Xa,2);
%using the function cov (see help cov)
CovMatrix=cov(Xa'); %Xa'--> row_i=observations_i col_j=variables_j (variable is the x value)
[V,D]=eig(CovMatrix);
[PC, LATENT, EXPLAINED] = pcacov(CovMatrix);
higher=find(cumsum(EXPLAINED)>=ExplainPercent*100);
tEigenvectors=PC(:,1:higher(1));
tEigenValues=LATENT(1:higher(1));
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?