function pitchGUI()               

%**************************************************************%
%This functions creates a graphical user interface which       %
%contains an animation of the pitch controller example.  This  %
%function was created for the Control Tutorials for Matlab. It %
%requires the function pitchFUN.m to be executed.              %       
%                                                              %
%Copyright (C) 1997 by the Regents of the University of        %
%Michigan.                                                     %
%**************************************************************%                
    
a = figure('Units','points', ...
	'Color',[1 1 1], ...
	'Position',[417.6 154.4 600 600], ...
	'Tag','Fig1');

whitebg
whitebg	

b = axes('Parent',a, ...
	'Box','on', ...
	'Color',[1 1 1], ...
	'Position',[0.577977 0.581098 0.327023 0.343902], ...
	'Tag','Axes1', ...
	'XColor',[0 0 0], ...
	'XLim',[0 10], ...
	'XLimMode','manual', ...
	'YColor',[0 0 0], ...
	'YLim',[0 0.25], ...
	'YLimMode','manual');
	
c = text('Parent',b, ...
	'Color',[0 0 0], ...
	'HorizontalAlignment','center', ...
	'Position',[4.97951 0.257296 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',[-1.37295 0.125 0], ...
	'Rotation',90, ...
	'String','Pitch angle (rad)', ...
	'Tag','Text2', ...
	'VerticalAlignment','baseline');
set(get(c,'Parent'),'YLabel',c);

c = text('Parent',b, ...
	'Color',[0 0 0], ...
	'HorizontalAlignment','center', ...
	'Position',[4.97951 -0.0189689 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','Axes2', ...
	'XColor',[0 0 0], ...
	'XLim',[-0.7 0.7], ...
	'XLimMode','manual', ...
	'YColor',[0 0 0], ...
	'YLim',[-0.25 0.25], ...
	'YLimMode','manual', ...
	'ZColor',[0 0 0]);
	
c = text('Parent',b, ...
	'Color',[0 0 0], ...
	'HorizontalAlignment','center', ...
	'Position',[-0.00286885 0.264591 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.00286885 -0.287938 0], ...
	'Tag','Text5', ...
	'VerticalAlignment','cap');
set(get(c,'Parent'),'XLabel',c);

c = text('Parent',b, ...
	'Color',[0 0 0], ...
	'HorizontalAlignment','center', ...
	'Position',[-0.938115 0 0], ...
	'Rotation',90, ...
	'Tag','Text6', ...
	'VerticalAlignment','baseline');
set(get(c,'Parent'),'YLabel',c);

b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[0 0 0], ...
	'Position',[0.117333 0.16 0.253333 0.178667], ...
	'Style','frame', ...
	'Tag','stepframe');
	
b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.126143 0.28 0.235714 0.0485714], ...
	'String','Manual Advance', ...
	'Style','checkbox', ...
	'Tag','manbox');
	
b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.126143 0.224286 0.235714 0.0485714], ...
	'String','Plot Separately', ...
	'Style','checkbox', ...
	'Tag','plotbox');
	
b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.126143 0.17 0.235714 0.0485714], ...
	'String','Reference Input', ...
	'Style','checkbox', ...
	'Tag','reference', ...
	'Value',1);
	
b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[0 0 0], ...
	'Position',[0.1 0.378667 0.288 0.125333], ...
	'Style','frame', ...
	'Tag','Frame1');

b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.106667 0.386667 0.274667 0.109333], ...
	'Style','frame', ...
	'Tag','timeframe');

b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Callback','pitchFUN(3)', ...
	'Max',0.35, ...
	'Min',-0.35, ...
	'Position',[0.184 0.412 0.118667 0.024], ...
	'Style','slider', ...
	'Tag','stepslider', ...
	'Value',0.3);

b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.112 0.409333 0.0653333 0.024], ...
	'String','-0.35', ...
	'Style','text', ...
	'Tag','slid_min');

b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.309333 0.409333 0.068 0.024], ...
	'String',' 0.35', ...
	'Style','text', ...
	'Tag','slid_max');

b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.136 0.46 0.0933333 0.0213333], ...
	'String','Step Input:', ...
	'Style','text', ...
	'Tag','step_text');

b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.228 0.461333 0.0853333 0.0213333], ...
	'String','0.3000', ...
	'Style','text', ...
	'Tag','curtext');

b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.302667 0.46 0.0466667 0.024], ...
	'String','rad.', ...
	'Style','text', ...
	'Tag','StaticText1');

b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[0 0 0], ...
	'Position',[0.131857 0.737143 0.224286 0.165714], ...
	'Style','frame', ...
	'Tag','ballxframe');
	
b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.139714 0.745 0.208571 0.15], ...
	'Style','frame', ...
	'Tag','thetaframe');
	
b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 0 0], ...
	'Callback','pitchFUN(1)', ...
	'Position',[0.186 0.826667 0.116 0.044], ...
	'String','RUN', ...
	'Tag','Runbutton', ...
	'Value',1);
	
b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 0], ...
	'Callback','pitchFUN(2)', ...
	'Position',[0.197333 0.769333 0.0933333 0.0426667], ...
	'String','RESET', ...
	'Tag','Restbutton');
	
b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[0 0 0], ...
	'Position',[0.124 0.549333 0.24 0.148], ...
	'Style','frame', ...
	'Tag','cartframe');
	
b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.132667 0.559333 0.222667 0.128], ...
	'Style','frame', ...
	'Tag','pendframe');
	
b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.151333 0.613333 0.185333 0.0306667], ...
	'String','Weighing Factor', ...
	'Style','text', ...
	'Tag','xytitle');
	
b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.179333 0.642667 0.129333 0.0293333], ...
	'String','Pitch Angle', ...
	'Style','text', ...
	'Tag','staticytext');
	
b = uicontrol('Parent',a, ...
	'Units','normalized', ...
	'BackgroundColor',[1 1 1], ...
	'Position',[0.207333 0.573333 0.0733333 0.0373333], ...
	'String','50', ...
	'Style','edit', ...
	'Tag','wfactor', ...
	'Value',1);
