📄 da_glpc1.m
字号:
%
% da_glpc1.m
%
% Genetic PCA regression
%
% Linear model
% Dynamic model
% Filter constants determined by the GA
% Number of principal components also determined by the GA
%
global stop;
stop=0;
da_front;
drawnow;
set(w1,'NumberTitle','off','Name','Genetic Model: Dynamic 1st order PCR');
%
% Print title
%
text1=da_text(w1,135,410,350,15,'Using previously select variables and I/Os for model building',[1 1 1],[1 0 0]);
%
% Genetic Algorithm Parameters
%
box1=uicontrol(w1,...
'style','frame',...
'position',[50 200 520 200],...
'foregroundColor',[1 1 1],...
'backgroundcolor',[0 0 1]);
text2=da_text(w1,55,380,200,15,'Genetic Algorithm parameters',[1 1 1],[1 0 0]);
%
% Stuff for popultaion size
%
text3=da_text(w1,60,350,100,15,'Population size:',[1 1 1],[0 0 1]);
sl1=uicontrol(w1,...
'style','slider',...
'position',[220,350,150,20],...
'min',5,...
'max',50,...
'value',20,...
'callback','set(sl1_current,''String'',[''Size = '' num2str(ceil(get(sl1,''value'')))]);');
sl1_current=da_text(w1,280,370,90,15,['Size = 20'],[1 1 1],[0 0 1]);
sl1_min=da_text(w1,200,350,15,15,'5',[1 1 1],[0 0 1]);
sl1_max=da_text(w1,375,350,20,15,'50',[1 1 1],[0 0 1]);
%
% Mutation probability
%
text4=da_text(w1,60,305,120,15,'Mutation probability:',[1 1 1],[0 0 1]);
sl2=uicontrol(w1,...
'style','slider',...
'position',[220 305 150 20],...
'min',0,...
'max',0.1,...
'value',0.01,...
'callback','set(sl2_current,''String'',[''Probability = '' num2str(get(sl2,''value''))]);');
sl2_current=da_text(w1,250,325,120,15,'Probability = 0.01',[1 1 1],[0 0 1]);
sl2_min=da_text(w1,200,305,15,15,'0',[1 1 1],[0 0 1]);
sl2_max=da_text(w1,375,305,20,15,'0.1',[1 1 1],[0 0 1]);
%
% Cross over probability
%
text5=da_text(w1,60,260,130,15,'Cross over probability:',[1 1 1],[0 0 1]);
sl3=uicontrol(w1,...
'style','slider',...
'position',[220 260 150 20],...
'min',0,...
'max',0.1,...
'value',0.01,...
'callback','set(sl3_current,''string'',[''Probability = '' num2str(get(sl3,''value''))]);');
sl3_current=da_text(w1,250,280,120,15,'Probability = 0.01',[1 1 1],[0 0 1]);
sl3_min=da_text(w1,200,260,15,15,'0',[1 1 1],[0 0 1]);
sl3_max=da_text(w1,375,260,20,15,'0.1',[1 1 1],[0 0 1]);
%
% Maximum number of generations
%
text6=da_text(w1,60,215,130,15,'Max generations',[1 1 1],[0 0 1]);
sl4=uicontrol(w1,...
'style','slider',...
'position',[220 215 150 20],...
'min',1,...
'max',500,...
'value',50,...
'callback','set(sl4_current,''string'',[''Max = '' num2str(ceil(get(sl4,''value'')))]);');
sl4_current=da_text(w1,250,235,120,15,'Max = 50',[1 1 1],[0 0 1]);
sl4_min=da_text(w1,200,215,15,15,'1',[1 1 1],[0 0 1]);
sl4_max=da_text(w1,375,215,30,15,'500',[1 1 1],[0 0 1]);
%
% When to plot results
%
text7=da_text(w1,50,160,150,15,'Plot results every:',[1 1 1],[0 0 1]);
text9=da_text(w1,250,160,80,15,'generations',[1 1 1],[0 0 1]);
text8=uicontrol(w1,...
'style','edit',...
'position',[205 160 30 15],...
'string','2',...
'Backgroundcolor',[1 0 0],...
'foregroundcolor',[1 1 1],...
'callback',[
'a=get(text8,''string'');',...
'a=str2num(a);',...
'if a ~= [];',...
'set(text8,''string'',num2str(a));',...
'else;',...
'set(text8,''string'',''2'');',...
'end']);
%
% Regression options
%
text10=da_text(w1,50,130,150,15,'Filter coefficients - Min:',[1 1 1],[0 0 1]);
text11=uicontrol(w1,...
'style','edit',...
'position',[205 130 30 15],...
'string','0',...
'backgroundcolor',[1 0 0],...
'foregroundcolor',[1 1 1],...
'callback',[
'a=get(text11,''string'');',...
'a=str2num(a);',...
'if a ~= [];',...
'set(text11,''string'',num2str(a));',...
'else;',...
'set(text11,''string'',''0'');',...
'end']);
text12=da_text(w1,250,130,80,15,'Resolution:',[1 1 1],[0 0 1]);
text13=uicontrol(w1,...
'style','edit',...
'position',[340 130 50 15],...
'string','0.01',...
'backgroundcolor',[1 0 0],...
'foregroundcolor',[1 1 1],...
'callback',[
'a=get(text13,''string'');',...
'a=str2num(a);',...
'if a ~= [];',...
'set(text13,''string'',num2str(a));',...
'else;',...
'set(text13,''string'',''0.01'');',...
'end']);
text14=da_text(w1,420,130,30,15,'Max:',[1 1 1],[0 0 1]);
text15=uicontrol(w1,...
'style','edit',...
'position',[455 130 30 15],...
'string','1',...
'backgroundcolor',[1 0 0],...
'foregroundcolor',[1 1 1],...
'callback',[
'a=get(text15,''string'');',...
'a=str2num(a);',...
'if a ~= [];',...
'set(text15,''string'',num2str(a));',...
'else;',...
'set(text15,''string'',''1'');',...
'end']);
%
% Begin button
%
but1=uicontrol(w1,...
'style','push',...
'position',[450 290 80 40],...
'string','START !',...
'callback','da_ga5');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -