function bbGUI() %**************************************************************% %This functions creates a graphical user interface which % %contains an animation of the ball and beam control experiment.% %This function was created for the Control Tutorials for % %Matlab. It requires the functions bbFUN.m and bbFUNODE.m to % %be executed. % % % %Copyright (C) 1997 by the Regents of the University of % %Michigan. % %**************************************************************% a = figure('Color',[1 1 1], ... 'Position',[440 124 700 700], ... 'Tag','Fig1'); whitebg whitebg b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[0 0 0], ... 'Position',[0.128571 0.514286 0.228571 0.192857], ... 'Style','frame', ... 'Tag','Nbarframe'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.137143 0.522857 0.211429 0.177143], ... 'Style','frame', ... 'Tag','Kframe'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.181429 0.672857 0.115714 0.02], ... 'String','Place Poles', ... 'Style','text', ... 'Tag','placetext'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.155714 0.627143 0.0585714 0.035], ... 'String','-2', ... 'Style','edit', ... 'Tag','realtext', ... 'Value',1); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.25 0.627143 0.0585714 0.035], ... 'String','5', ... 'Style','edit', ... 'Tag','imagtext', ... 'Value',1); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.225 0.64 0.017 0.020], ... 'String','+', ... 'Style','text', ... 'Tag','plustext'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.225 0.624 0.017 0.017], ... 'String','-', ... 'Style','text', ... 'Tag','minustext'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.311429 0.631429 0.0185714 0.0185714], ... 'String','i', ... 'Style','text', ... 'Tag','itext'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.198571 0.58 0.0857143 0.035], ... 'String','-20', ... 'Style','edit', ... 'Tag','pole3'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.198571 0.538571 0.0857143 0.035], ... 'String','-80', ... 'Style','edit', ... 'Tag','pole4'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[0 0 0], ... 'Position',[0.122857 0.365714 0.244286 0.125714], ... 'Style','frame', ... 'Tag','Frame1'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.13 0.374286 0.228571 0.108571], ... 'Style','frame', ... 'Tag','timeframe'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Callback','bbFUN(3)', ... 'Max',0.5, ... 'Min',-0.5, ... 'Position',[0.187143 0.395714 0.118571 0.0242857], ... 'Style','slider', ... 'Tag','stepslider', ... 'Value',0.25); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.137143 0.398571 0.0442857 0.0185714], ... 'String','-50', ... 'Style','text', ... 'Tag','slid_min'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.307143 0.398571 0.0357143 0.0185714], ... 'String',' 50', ... 'Style','text', ... 'Tag','slid_max'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.151429 0.444286 0.0928571 0.0214286], ... 'String','Step Input:', ... 'Style','text', ... 'Tag','step_text'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.238571 0.444286 0.0842857 0.0214286], ... 'String','25.00', ... 'Style','text', ... 'Tag','curtext'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[0 0 0], ... 'Position',[0.13 0.737143 0.224286 0.165714], ... 'Style','frame', ... 'Tag','ballxframe'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.138571 0.744286 0.208571 0.15], ... 'Style','frame', ... 'Tag','thetaframe'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 0 0], ... 'Callback','bbFUN(1)', ... 'Position',[0.188571 0.825714 0.115714 0.0442857], ... 'String','RUN', ... 'Tag','Runbutton', ... 'Value',1); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[0 1 0], ... 'Callback','bbFUN(2)', ... 'Position',[0.258571 0.767143 0.0728571 0.0428571], ... 'String','RESET', ... 'Tag','Restbutton'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[0 1 0], ... 'Callback','bbFUN(4)', ... 'Position',[0.154286 0.767143 0.0728571 0.0428571], ... 'String','REPEAT', ... 'Tag','repbutton'); b = axes('Parent',a, ... 'Box','on', ... 'Color',[1 1 1], ... 'NextPlot','add', ... 'Position',[0.577977 0.581098 0.327023 0.343902], ... 'Tag','anim_axes', ... 'XColor',[0 0 0], ... 'XLim',[0 6], ... 'XLimMode','manual', ... 'YColor',[0 0 0], ... 'YLim',[0 50], ... 'YLimMode','manual'); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HorizontalAlignment','center', ... 'Position',[2.98684 51.3542 0], ... 'String','Step Response', ... 'Tag','Text1', ... 'VerticalAlignment','bottom'); set(get(c,'Parent'),'Title',c); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HorizontalAlignment','center', ... 'Position',[-0.539474 25.1042 0], ... 'Rotation',90, ... 'String','Ball Position (cm)', ... 'Tag','Text2', ... 'VerticalAlignment','baseline'); set(get(c,'Parent'),'YLabel',c); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HorizontalAlignment','center', ... 'Position',[2.98684 -3.64583 0], ... 'String','Time (sec)', ... 'Tag','Text3', ... 'VerticalAlignment','cap'); set(get(c,'Parent'),'XLabel',c); b = axes('Parent',a, ... 'Box','on', ... 'Color',[1 1 1], ... 'Position',[0.577977 0.11 0.327023 0.343902], ... 'Tag','step_axes', ... 'XColor',[0 0 0], ... 'XLim',[-55 55], ... 'XLimMode','manual', ... 'YColor',[0 0 0], ... 'YLim',[-55 55], ... 'YLimMode','manual'); c = line('Parent',b, ... 'Color',[1 0 0], ... 'EraseMode','xor', ... 'LineWidth',3, ... 'Tag','Line2', ... 'XData',[-50 50], ... 'YData',[0 -0]); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HorizontalAlignment','center', ... 'Position',[-0.241228 57.9792 0], ... 'String','Animation', ... 'Tag','Text4', ... 'VerticalAlignment','bottom'); set(get(c,'Parent'),'Title',c); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HorizontalAlignment','center', ... 'Position',[-0.241228 -63.0208 0], ... 'String','Horizontal Position (cm)', ... 'Tag','Text5', ... 'VerticalAlignment','cap'); set(get(c,'Parent'),'XLabel',c); c = text('Parent',b, ... 'Color',[0 0 0], ... 'HorizontalAlignment','center', ... 'Position',[-68.2675 0.229167 0], ... 'Rotation',90, ... 'String','Vertical Position (cm)', ... 'Tag','Text6', ... 'VerticalAlignment','baseline'); set(get(c,'Parent'),'YLabel',c); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[0 0 0], ... 'Position',[0.118571 0.105714 0.252857 0.232857], ... 'Style','frame', ... 'Tag','stepframe'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.127143 0.28 0.235714 0.0485714], ... 'String','Manual Advance', ... 'Style','checkbox', ... 'Tag','Checkbox'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.127143 0.224286 0.235714 0.0485714], ... 'String','Plot Separately', ... 'Style','checkbox', ... 'Tag','Checkbox2'); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.127143 0.17 0.235714 0.0485714], ... 'String','Reference Input', ... 'Style','checkbox', ... 'Tag','Checkbox3', ... 'Value',1); b = uicontrol('Parent',a, ... 'Units','normalized', ... 'BackgroundColor',[1 1 1], ... 'Position',[0.127143 0.114286 0.235714 0.0485714], ... 'String','Non-Linear System', ... 'Style','checkbox', ... 'Tag','syscheckbox');