⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 da_plsut.m

📁 王小平《遗传算法——理论、应用与软件实现》随书光盘
💻 M
字号:
%
% da_2dsc
%
% Programme for plotting 2D scatter graphs

%
% Sort the screen out
%
da_front;
w1=gcf;
drawnow;
ax1=axes(...
	'Units','pixels',...
	'Position',[50 150 500 250],...
	'Box','on',...
	'Color',[0 0 0],...
	'Visible','on');

%
% Print a title
%
text1=da_text(w1,130,405,350,15,'Plot of U v T',[1 1 1],[1 0 0]);

%
% Display some text that shows correlation
%
text2=da_text(w1,170,20,300,15,'Correlation of these latent variables = ',[1 1 1],[0 0 1]);


%
% Plot the first pair of latent variables
%
plot(U(:,1),T(:,1),'+');
c=corrcoef(U(:,1),T(:,1));
set(text2,'String',['Correlation of these latent variables = ' num2str(c(1,2))]);
Xlabel('U');
Ylabel('T');
old_val1=1;
old_val2=1;
sl1_value=1;
sl2_value=1;
p_style=0;
[DU LU]=size(U);
[DT LT]=size(T);

%
% Have a slider to change which pc to plot
%

sl1=uicontrol(w1,...
	'Style','slider',...
	'Position',[150 60 200 20],...
	'Min',1,...
	'Max',LU,...
	'Value',1,...
	'CallBack',[
		'set(sl1_current,''String'',ceil(get(sl1,''Value'')));',...
		'sl1_value=ceil(get(sl1,''Value''));',...
		'if sl1_value ~= old_val1;',...
			'set(sl1_current,''String'',num2str(ceil(sl1_value)));',...
			'if p_style == 0;',...
				'cla;',...
				'plot(U(:,sl1_value),T(:,sl1_value),''+'');',...
			'else;',...
				'cla;',...
				'plotnum(U(:,sl1_value),T(:,sl1_value),ax1);',...
			'end;',...
			'old_val1=sl1_value;',...
			'Xlabel(''U'');',...
			'Ylabel(''T'');',...
			'c=corrcoef(U(:,sl1_value),T(:,sl1_value));',...
			'set(text2,''string'',[''Correlation of these latent variables = '' num2str(c(2,1))]);',...
		'end;']);

sl1_current=uicontrol(w1,...
	'Style','text',...
	'Position',[320 80 20 15],...
	'BackGroundColor',[0 0 0],...
	'ForeGroundColor',[1 1 1],...
	'String',num2str(get(sl1,'Value')));

sl1_min=uicontrol(w1,...
	'Style','text',...
	'Position',[130 60 15 15],...
	'BackGroundColor',[0 0 0],...
	'ForeGroundColor',[1 1 1],...
	'String','1');

sl1_max=uicontrol(w1,...
	'Style','text',...
	'Position',[360 60 20 15],...
	'BackGroundColor',[0 0 0],...
	'ForeGroundColor',[1 1 1],...
	'String',num2str(LU));

sl1_title=uicontrol(w1,...
	'Style','text',...
	'Position',[100 80 220 15],...
	'BackGroundColor',[0 0 0],...
	'ForeGroundColor',[1 1 1],...
	'String','Choose a pair of latent variables:');


%
% Two buttons for plot numbers or plot crosses
%
but3=uicontrol(w1,...
	'style','push',...
	'position',[560 350 55 30],...
	'string','1,2,3,...',...
	'callback',[
		'cla;',...
		'plotnum(U(:,sl1_value),T(:,sl1_value),ax1);',...
		'Xlabel(''U'');',...
		'Ylabel(''T'');',...
		'p_style=1;']);


but4=uicontrol(w1,...
	'style','push',...
	'position',[560 300 55 30],...
	'string','+++',...
	'callback',[
		'cla;',...
		'plot(U(:,sl1_value),T(:,sl1_value),''+'');',...
		'Xlabel(''U'');',...
		'Ylabel(''T'');',...
		'p_style=0;']);

⌨️ 快捷键说明

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