da_pca.m

来自「wang xiao ping 版遗传算法」· M 代码 · 共 65 行

M
65
字号
%
% da_pca
%
% Entry point into PCA routines
%

%
% Clear whole screen
%

clg;
drawnow;
set(w1,'NumberTitle','off','Name','Principal Component Variances');
%
% Say it's calculating data
%
text1=uicontrol(w1,...
	'Style','text',...
	'Position',[230 300 150 15],...
	'String','Working. Please wait....',...
	'BackGroundColor',[0 0 0],...
	'ForeGroundColor',[1 1 1]);


%
% Prepare the process data by including the desired variables
% and excluding the output variable
%
pc_data=pcincl(data,include_var,output_var);
%
% Now work through the data to make sure that there are no
% variables that remain constant. If there are, remove them.
%
[D L]=size(pc_data);
s=std(pc_data);
count=1;
for i = 1 : L
	if s(i)~=0
		temp(:,count)=pc_data(:,i);
		count=count+1;
	else
		include_var(i)=0;
		output_var(i)=0;
	end
end
pc_data=temp;
clear temp 

[pc_data m s]=mcen(pc_data);
%[D L]=size(pc_data);
%[pcs c ssq res q tst]=pca(pc_data,0,0,L);
%
% Own PCA routine
%
[pcs c ssq]=pcomp(pc_data);

clear pc_data m 
[dummy num_pcs]=size(pcs);


%
% Draw the axes
%
da_pcavr;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?