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

📄 gui_con2.m

📁 FISMAT accommodates different arithmetic operators, fuzzification and defuzzification algorithm, imp
💻 M
字号:
function gui_con2(action,in1,in2);

%# call t3mi t1bd t15ep t2ap s3ma s1bs s15es s2as s25hs

% gui_con2
%
% GUI driven demonstration file for logical connectives.
%
%
% FSTB - Fuzzy Systems Toolbox for MATLAB
% Copyright (c) 1993-1996 by Olaf Wolkenhauer
% Control Systems Centre at UMIST
% Manchester M60 1QD, UK
%
% 21-October-19946
% Last change 21/11/96

%	possible actions:
%	  'start'          	initialises the demo file.
%	  'redraw'		following each change in menus redraw
%	  'done'		exit the demo
 
if nargin<1,
    action='start';
end;

% Declare handles of menus global :
  global oper_Hndl

% Declare axes for plots global :
  global set_axes result_axes

oldFigNumber = [];

if strcmp(action,'start'),	
  % Graphics initialization
  figNumber = figure;
  oldFigNumber = watchon;
  set(gcf, ...
      'NumberTitle','off', ...
      'Name','Fuzzy Logic Connectives', ...
      'backingstore','off',...
      'Units','normalized');

  % Information for all buttons
  labelColor=192/255*[1 1 1];
  top=0.95; bottom=0.05;
  yInitLabelPos=0.90;
  left = 0.78; left_label=left-0.004;
  labelWid=0.18; labelHt=0.05;
  btnWid = 0.18; btnHt=0.07;

  % Spacing between the label and the button for the same command
  btnOffset=0.003;
  
  % Spacing between the button and the next command's label
  spacing=0.05; % vertical gap
  
  % The CONSOLE frame
  frmBorder=0.02;
  yPos=0.05-frmBorder;
  frmPos=[left-frmBorder yPos btnWid+2*frmBorder 0.9+2*frmBorder];
  console_Hndl=uicontrol( ...
    'Style','frame', ...
    'Units','normalized', ...
    'Position',frmPos, ...
    'BackgroundColor',[0.5 0.5 0.5]);
 
  % The SET-OPERATION command popup button/menu
  btnNumber=1;
  yLabelPos=top-(btnNumber-1)*(btnHt+labelHt+spacing);

  % Generic label information
  labelPos=[left_label yLabelPos-labelHt labelWid labelHt];
  uicontrol( ...
    'Style','text', ...
    'Units','normalized', ...
    'Position',labelPos, ...
    'BackgroundColor',labelColor, ...
    'HorizontalAlignment','Center', ...
    'String',' Set-Operation');

  btnPos=[left yLabelPos-labelHt-btnHt-btnOffset btnWid btnHt];
  oper_Hndl=uicontrol( ...
    'Style','Popup',...
    'String','t3mi|t1bd|t2ap|s3ma|s1bs|s15es|s2as|s25hs',...
    'Position', btnPos, ...
    'Value',[ 1 ],...
    'Units','normalized',...
    'CallBack','gui_con2(''redraw'')');
 
  % The INFO button
  uicontrol( ...
    'Style','push', ...
    'Units','normalized', ...
    'Position',[left bottom+(2*labelHt)+spacing btnWid 2*labelHt], ...
    'String','Info', ...
    'Callback','gui_con2(''info'')');
 
  % The CLOSE button
  done_button=uicontrol('Style','Pushbutton', ...
    'Position',[left bottom btnWid 2*labelHt], ...
    'Units','normalized','Callback',...
    'gui_con2(''done'')','String','Close');

  % Create axes for plots :
    set_axes  = axes('Position',[.12 .58 .6 .3], ...
                      'XLim',[0 100],'YLim',[0 1.1]);
    result_axes = axes('Position',[.12 .14 .6 .3], ...
                      'XLim',[0 100],'YLim',[0 1.1]);
  gui_con2('redraw');

elseif strcmp(action,'done'),
  close(gcf);
  clear global oper_Hndl  
  clear global set_axes result_axes

elseif strcmp(action,'redraw'),
  % recomputes outset and output value and updates display
  val = get(oper_Hndl,'Value');
  if (val == 1),
    CON1='t3mi';
  elseif (val == 2),
    CON1='t1bd';
  elseif (val == 3),
    CON1='t2ap';
  elseif (val == 4),
    CON1='s3ma';
  elseif (val == 5),
    CON1='s1bs';
  elseif (val == 6),
    CON1='s15es';
  elseif (val == 7),
    CON1='s2as';
  elseif (val == 8),
    CON1='s25hs';
  end;
  
  xmin = 0; xmax = 100; xmima = [xmin,xmax]; resx=150;

  [A,x] = modlrset('tr','',[xmima,20,40,20,20,0,1],resx);
  B = modlrset('tr','',[xmima,60,80,20,20,0,1],resx);
  watchoff(oldFigNumber);
 
  axes(set_axes);
  plot_set(x,A); hold on; plot_set(x,B);
 
  axes(result_axes);
  plot_set(x,feval(CON1,A,B));
 
  drawnow
 
elseif strcmp(action,'info'),
  ttlStr = 'Fuzzy Logic Connectives'; 
  hlpStr1= ...                                              
    ['  						  '];
  hlpStr2= ...                                               
    ['  						  '];
  hlpStr3= str2mat(...                   
    ' ', ...
    ' File name: gui_con2.m');

  helpfun(ttlStr, hlpStr1, hlpStr2, hlpStr3);
end; % of gui_con2.m

⌨️ 快捷键说明

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