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

📄 miden.m

📁 王小平《遗传算法——理论、应用与软件实现》随书光盘
💻 M
📖 第 1 页 / 共 2 页
字号:
	'Style','Text',...
	'Position',[90 35 60 15],...
	'String',num2str(sl3_value),...
	'ForegroundColor',[0 0 0],...
	'BackgroundColor',[1 1 1]);

%
% Change the maximum limit of the slider using edit-able text option
%

sl3_max=uicontrol(w1,...
	'style','edit',...
	'position',[140 20 40 15],...
	'string',num2str(max3),...		%get the current vale of the variable
	'foregroundcolor',[0 0 0],...
	'backgroundcolor',[1 1 1],...
	'callback',[
		'max3=str2num(get(sl3_max,''string''));',...  %read in the new value that the user has typed
		'set(sl3,''Max'',max3);',...
		'max_vector(3,input_fit)=max3;']);  %set the variable 'Max' related to slider object sl1 to the value of fart

%
% Change the minimum limit of the slider using edit-able text option
%

sl3_min=uicontrol(w1,...
	'style','edit',...
	'position',[25 20 35 15],...
	'string',num2str(min3),...		%get the current vale of the variable
	'foregroundcolor',[0 0 0],...
	'backgroundcolor',[1 1 1],...
	'callback',[
		'min3=str2num(get(sl3_min,''string''));',...  %read in the new value that the user has typed
		'set(sl3,''Min'',min3);',...
		'min_vector(3,input_fit)=min3;']);  %set the variable 'max' related to slider object sl1 to the value of fart

%
% sliders used to define the steady state values of the variables u and y
%

sl4_value=yss;
max4=max(output_data);
min4=min(output_data);

sl4=uicontrol(w1,...
	'style','slider',...
	'position',[65 235 70 15],...
	'BackgroundColor',[0.75 0.75 0.75],...
	'Min',min4,...
	'Max',max4,...
	'Value',sl4_value,...
	'CallBack',[
		'sl4_value=(get(sl4,''Value''));',...
		'set(text19,''string'',num2str(sl4_value));',...
		'modified_y = y - sl4_value;',...
		'drawnow;']);

% Output steady state...

text18=da_text(w1,50,250,50,15,'Yss =',[0 0 0],[1 1 1]);
text19=uicontrol(w1,...
	'Style','Text',...
	'Position',[90 250 60 15],...
	'String',num2str(sl4_value),...
	'ForegroundColor',[0 0 0],...
	'BackgroundColor',[1 1 1]);

%
% Change the maximum limit of the slider using edit-able text option
%

sl4_max=uicontrol(w1,...
	'style','edit',...
	'position',[140 235 40 15],...
	'string',num2str(max4),...		%get the current vale of the variable
	'foregroundcolor',[0 0 0],...
	'backgroundcolor',[1 1 1],...
	'callback',[
		'max4=str2num(get(sl4_max,''string''));',...  %read in the new value that the user has typed
		'set(sl4,''Max'',max4);']);  %set the variable 'Max' related to slider object sl1 to the value of fart

%
% Change the minimum limit of the slider using edit-able text option
%

sl4_min=uicontrol(w1,...
	'style','edit',...
	'position',[25 235 35 15],...
	'string',num2str(min4),...		%get the current vale of the variable
	'foregroundcolor',[0 0 0],...
	'backgroundcolor',[1 1 1],...
	'callback',[
		'min4=str2num(get(sl4_min,''string''));',...  %read in the new value that the user has typed
		'set(sl4,''Min'',min4);']);  %set the variable 'max' related to slider object sl1 to the value of fart

% Input steady states...

sl5_value=uss(input_fit);
max5=max(input_data(:,input_fit));
min5=min(input_data(:,input_fit));

sl5=uicontrol(w1,...
	'style','slider',...
	'position',[65 190 70 15],...
	'BackgroundColor',[0.75 0.75 0.75],...
	'Min',min5,...
	'Max',max5,...
	'Value',sl5_value,...
	'CallBack',[
		'sl5_value=(get(sl5,''Value''));',...
		'set(text23,''string'',num2str(sl5_value));',...
		'uss(1,input_fit)=sl5_value;',...
		'modified_u(:,input_fit)=u(:,input_fit)-sl5_value;',...
		'drawnow;']);

text22=da_text(w1,50,205,50,15,'Uss =',[0 0 0],[1 1 1]);
text23=uicontrol(w1,...
	'Style','Text',...
	'Position',[90 205 60 15],...
	'String',num2str(sl5_value),...
	'ForegroundColor',[0 0 0],...
	'BackgroundColor',[1 1 1]);

%
% Change the maximum limit of the slider using edit-able text option
%

sl5_max=uicontrol(w1,...
	'style','edit',...
	'position',[140 190 40 15],...
	'string',num2str(max5),...		%get the current vale of the variable
	'foregroundcolor',[0 0 0],...
	'backgroundcolor',[1 1 1],...
	'callback',[
		'max5=str2num(get(sl5_max,''string''));',...  %read in the new value that the user has typed
		'set(sl5,''Max'',max5);']);  %set the variable 'Max' related to slider object sl1 to the value of fart

%
% Change the minimum limit of the slider using edit-able text option
%

sl5_min=uicontrol(w1,...
	'style','edit',...
	'position',[25 190 35 15],...
	'string',num2str(min5),...		%get the current vale of the variable
	'foregroundcolor',[0 0 0],...
	'backgroundcolor',[1 1 1],...
	'callback',[
		'min5=str2num(get(sl5_min,''string''));',...  %read in the new value that the user has typed
		'set(sl5,''Min'',min5);']);  %set the variable 'max' related to slider object sl1 to the value of fart

%
% **** end of the slider set up routines *******
%
	startbtn=uicontrol(gcf,'Style','Push',...
		'Position',[25 350 150 30],...
		'String','Fit Model',...
		'Callback',[...
			'axes(pic_ax);',...
			'cla;',...
			'simul_u=zeros(ID,9);',...
			'simul_u(1:1:ID,1:1:IL)=modified_u(1:1:ID,1:1:IL);',...
			'[tmod]=linsim(''midenmdl'',time_data,[],[], [time_data simul_u]);',...
			'plot(time_data,output_data,''y-'');',...
			'hold on;',...
			'ymod=ymod+get(sl4,''Value'');',...
			'plot(tmod,ymod,''c-'');',...
			'axes(pic_ax1);',...
			'plot(time_data,input_data(:,input_fit),''g-'');']);

	closebtn=uicontrol(gcf,'Style','Push',...
		'Position',[25 320 150 30],...
		'String','Previous screen...',...
		'Callback',[...
			'close_system(''midenmdl'',0);',...
			'da_front;']);

doutbut1=uicontrol(w1,...
	'style','Push',...
	'string', 'Dump Data',...
	'position',[25 380 150 30],...
	'CallBack',[...
		'dumpout;']);

simul_u=zeros(ID,9);
simul_u(1:1:ID,1:1:IL)=modified_u(1:1:ID,1:1:IL);

hold on;
axes(pic_ax);
plot(time_data,output_data,'y-');
grid on;
[tmod ymod]=linsim('midenmdl',time_data,[],[], [time_data simul_u]);
ymod=ymod+get(sl4,'Value');
plot(tmod,ymod,'c-');
axes(pic_ax1);
plot(time_data,input_data(:,input_fit),'g-');

%
%	Legends
%
	leg1_txt=uicontrol(main,...
		'Style','Text',...
		'BackgroundColor',[0 0 0],...
		'ForegroundColor',[1 1 1],...
		'Units','Pixels',...
		'Position',[200 400 80 15],...
		'String','Legend:                 ');

	leg2_txt=uicontrol(main,...
		'Style','Text',...
		'BackgroundColor',[0 0 0],...
		'ForegroundColor',[1 1 1],...
		'Units','Pixels',...
		'Position',[260 400 100 15],...
		'string',' process output -');

	leg5_txt=uicontrol(main,...
		'Style','Text',...
		'BackgroundColor',[0 0 0],...
		'ForegroundColor','y',...
		'Units','Pixels',...
		'Position',[360 400 80 15],...
		'string',' yellow ');

	leg3_txt=uicontrol(main,...
		'Style','Text',...
		'BackgroundColor',[0 0 0],...
		'ForegroundColor',[1 1 1],...
		'Units','Pixels',...
		'Position',[440 400 100 15],...
		'string',' manipulated -');

	leg6_txt=uicontrol(main,...
		'Style','Text',...
		'BackgroundColor',[0 0 0],...
		'ForegroundColor','g',...
		'Units','Pixels',...
		'Position',[540 400 80 15],...
		'string',' green');

	leg4_txt=uicontrol(main,...
		'Style','Text',...
		'BackgroundColor',[0 0 0],...
		'ForegroundColor',[1 1 1],...
		'Units','Pixels',...
		'Position',[260 385 110 15],...
		'String',' model response -        ');

	leg6_txt=uicontrol(main,...
		'Style','Text',...
		'BackgroundColor',[0 0 0],...
		'ForegroundColor','c',...
		'Units','Pixels',...
		'Position',[370 385 80 15],...
		'String',' cyan         ');

⌨️ 快捷键说明

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