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

📄 nnmodref.m

📁 RBF网络逼近、RBF-建模、RBF网络训练与测试程序
💻 M
📖 第 1 页 / 共 5 页
字号:
    set(H.Train_con,'enable','on')
    st=sprintf('Your training data set has %d samples.\nYou can now train the network.',N2-1);
    set(H.error_messages,'string',st);   
  else
    set(H.error_messages,'string',sprintf('Generate or import data before training the neural network controller.'));
    set(H.max_r_edit,'enable','on')
    set(H.max_r_text,'enable','on')
    set(H.min_r_edit,'enable','on')
    set(H.min_r_text,'enable','on')
    set(H.max_r_int_edit,'enable','on')
    set(H.max_r_int_text,'enable','on')
    set(H.min_r_int_edit,'enable','on')
    set(H.min_r_int_text,'enable','on')
    set(H.sam_training_c_text,'enable','on')
    set(H.sam_training_c_edit,'enable','on')
    set(H.BrowseButton,'enable','on');
    set(H.reference_model,'enable','on');
    set(H.reference_model_text,'enable','on');
  end
  drawnow; % pause needed to refresh the message
  
  fig2=findall(0,'type','figure','tag','ind_adap_data');
  if (size(fig2,1)==0), fig2=0; end
  
  delete(fig2);
  if exist(cat(2,tempdir,'ind_adap_data2.mat'))
     delete(cat(2,tempdir,'ind_adap_data2.mat'));
  end
  
  % We refresh the menu.
  arg1=get(H.gcbh_ptr,'userdata');
  arg2=get(H.gcb_ptr,'userdata');
  nncontrolutil('nnmodref','',arg1,arg2,'');
  
%==================================================================
% Initialize the window.
%
% ME('init')
%==================================================================

elseif strcmp(cmd,'init') & (~fig)
  % 1-13-00 ODJ We check if the system is locked.
  sys_par=arg2;
  sys_par2=arg2;
  while ~isempty(sys_par2)
      sys_par=sys_par2;
      sys_par2=get_param(sys_par,'parent');
  end
  if strcmp('on',get_param(sys_par,'lock'))
      window_en='off';
  else
      window_en='on';
  end

  H.StdColor = get(0,'DefaultUicontrolBackgroundColor');
  H.StdUnit='points';
  H.PointsToPixels = 72/get(0,'ScreenPixelsPerInch');
  
  fig = figure('Units','points', ...
   'Interruptible','off', ...
   'BusyAction','cancel', ...
   'HandleVis','Callback', ...
  'CloseRequestFcn','nncontrolutil(''nnmodref'',''close'')', ...
   'Color',[0.8 0.8 0.8], ...
  'MenuBar','none', ...
   'Name',me, ...
   'numbertitle','off', ...
   'IntegerHandle',  'off',...
  'PaperUnits','points', ...
  'Position',[45 30 350 338], ...
  'Tag','Fig4', ...
  'ToolBar','none');
  frame4 = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
  'ListboxTop',0, ...
  'Position',[5 2 340 22], ...
  'Style','frame', ...
  'Tag','Frame4');
  frame5 = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
  'ListboxTop',0, ...
  'Position',[5 26 340 67], ...
  'Style','frame', ...
  'Tag','Frame5');
  h1 = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[130 83.5 90.25 15], ...
  'String','Training Parameters', ...
  'Style','text', ...
  'Tag','StaticText1');
  frame1 = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
  'ListboxTop',0, ...
  'Position',[5 103 340 115], ...
  'Style','frame', ...
  'Tag','Frame1');
  h1 = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[140 207.75 70.25 15], ...
  'String','Training Data', ...
  'Style','text', ...
  'Tag','StaticText1');
  frame6 = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
  'ListboxTop',0, ...
  'Position',[5 226 340 73], ...
  'Style','frame', ...
  'Tag','Frame6');
  h1 = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[130 288.75 90.25 15], ...
  'String','Network Architecture', ...
  'Style','text', ...
  'Tag','StaticText1');
  H.Title_nnmodref = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
  'FontSize',14, ...
  'ListboxTop',0, ...
  'Position',[24.75 308 298.5 21.75], ...
  'String','Model Reference Control', ...
  'Style','text', ...
  'Tag','Title_nnmodref');
  H.Use_Inc_training_but = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[175 48 120 15], ...
  'String','Use Cumulative Training', ...
  'Style','checkbox', ...
   'ToolTipStr','Trains the controller by adding one segment of data at a time to the training set.',...
  'Tag','checkbox1');
  H.epochs_c_text = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
    'Enable',window_en, ...
   'HorizontalAlignment','right', ...
  'ListboxTop',0, ...
  'Position',[10 65 110 15], ...
  'String','Controller Training Epochs', ...
  'Style','text', ...
   'ToolTipStr','Defines the number of iterations per training segment.',...
  'Tag','StaticText2');
  H.epochs_c_edit = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[1 1 1], ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[125 65 45 15], ...
  'Style','edit', ...
   'ToolTipStr','Defines the number of iterations per training segment.',...
  'Tag','epochs_c_edit');
  H.Sampling_text = uicontrol('Parent',fig, ...
  'Units','points', ...
   'BackgroundColor',[0.8 0.8 0.8], ...
   'Enable','off', ...
   'HorizontalAlignment','right', ...
  'ListboxTop',0, ...
  'Position',[10 252 110 15], ...
  'String','Sampling Interval (sec)', ...
  'Style','text', ...
   'ToolTipStr','Sampling interval at which the data will be collected from the Simulink plant model.',...
  'Tag','StaticText1');
  H.Sampling_time = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[1 1 1], ...
   'Enable','off', ...
  'ListboxTop',0, ...
  'Position',[125 252 45 15], ...
  'Style','edit', ...
   'ToolTipStr','Sampling interval at which the data will be collected from the Simulink plant model.',...
  'Tag','Sampling_time');
  H.retraining_c_text = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
    'Enable',window_en, ...
   'HorizontalAlignment','right', ...
  'ListboxTop',0, ...
  'Position',[175 65 110 15], ...
  'String','Controller Training Segments', ...
  'Style','text', ...
   'ToolTipStr','Defines how many segments the training data will be divided into.',...
  'Tag','StaticText2');
  H.retraining_c_edit = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[1 1 1], ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[290 65 45 15], ...
  'Style','edit', ...
   'ToolTipStr','Defines how many segments the training data will be divided into.',...
  'Tag','retraining_c_edit');
  H.max_r_text = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
    'Enable',window_en, ...
   'HorizontalAlignment','right', ...
  'ListboxTop',0, ...
  'Position',[10 195 110 15], ...
  'String','Maximum Reference Value', ...
  'Style','text', ...
   'ToolTipStr','Defines an upper bound on the random reference input for training.',...
  'Tag','StaticText2');
  H.max_r_edit = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[1 1 1], ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[125 195 45 15], ...
  'Style','edit', ...
   'ToolTipStr','Defines an upper bound on the random reference input for training.',...
  'Tag','max_r_edit');
  H.min_r_text = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
    'Enable',window_en, ...
   'HorizontalAlignment','right', ...
  'ListboxTop',0, ...
  'Position',[10 173 110 15], ...
  'String','Minimum Reference Value', ...
  'Style','text', ...
   'ToolTipStr','Defines a lower bound on the random reference input for training.',...
  'Tag','StaticText2');
  H.min_r_edit = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[1 1 1], ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[125 173 45 15], ...
  'Style','edit', ...
   'ToolTipStr','Defines a lower bound on the random reference input for training.',...
  'Tag','EditText1');
  H.max_r_int_text = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[10 151 110 15], ...
  'String','Maximum Interval Value (sec)', ...
  'Style','text', ...
   'ToolTipStr','Defines a maximum interval over which the random reference input will remain constant.',...
  'Tag','StaticText2');
  H.max_r_int_edit = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[1 1 1], ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[125 151 45 15], ...
  'Style','edit', ...
   'ToolTipStr','Defines a maximum interval over which the random reference input will remain constant.',...
  'Tag','max_r_edit');
  H.min_r_int_text = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
    'Enable',window_en, ...
   'HorizontalAlignment','right', ...
  'ListboxTop',0, ...
  'Position',[10 129 110 15], ...
  'String','Minimum Interval Value (sec)', ...
  'Style','text', ...
   'ToolTipStr','Defines a minimum interval over which the random reference input will remain constant.',...
  'Tag','StaticText2');
  H.min_r_int_edit = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[1 1 1], ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[125 129 45 15], ...
  'Style','edit', ...
   'ToolTipStr','Defines a minimum interval over which the random reference input will remain constant.',...
  'Tag','EditText1');
  H.Hidden_layer_size = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[1 1 1], ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[125 274 45 15], ...
  'Style','edit', ...
   'ToolTipStr','Defines the size of the second layer of the neural network controller.',...
  'Tag','Hidden_layer');
  H.Hidden_layer_text = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
    'Enable',window_en, ...
   'HorizontalAlignment','right', ...
  'ListboxTop',0, ...
  'Position',[10 274 110 15], ...
  'String','Size of Hidden Layer', ...
  'Style','text', ...
   'ToolTipStr','Defines the size of the second layer of the neural network controller.',...
  'Tag','StaticText1');
  H.reference_model_text = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[175 151 110 15], ...
  'String','Reference Model:', ...
  'Style','text', ...
   'ToolTipStr','Simulink file containing the reference model.',...
  'Tag','StaticText1');
  H.BrowseButton = uicontrol('Parent',fig, ...
  'Unit','points', ...
  'Callback','nncontrolutil(''nnmodref'',''browsesim'',gcbf);', ...
    'Enable',window_en, ...
  'ListboxTop',0, ...
  'Position',[290 151 45 16], ...
  'String','Browse', ...
   'ToolTipStr','Browse the disk to select a Simulink file.',...
  'Tag','BrowseButton');
  H.reference_model = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[1 1 1], ...
  'Callback','nncontrolutil(''nnmodref'',''clearpath'',gcbf);', ...
    'Enable',window_en, ...
  'HorizontalAlignment','left', ...
  'ListboxTop',0, ...
  'Position',[190 129 145 15], ...
  'Style','edit', ...
   'ToolTipStr','Simulink file containing the reference model.',...
  'Tag','Reference_model');
  H.Delayed_ref_input_text = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[0.8 0.8 0.8], ...
    'Enable',window_en, ...
   'HorizontalAlignment','right', ...
  'ListboxTop',0, ...
  'Position',[175 274 110 15], ...
  'String','No. Delayed Reference Inputs', ...
  'Style','text', ...
   'ToolTipStr','Defines how many delays on the reference input will be used to feed the controller.',...
  'Tag','StaticText1');
  H.Delayed_ref_input = uicontrol('Parent',fig, ...
  'Units','points', ...
  'BackgroundColor',[1 1 1], ...

⌨️ 快捷键说明

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