ball_bounce.m

来自「函数用来描述 Apollo 卫星的数学模型」· M 代码 · 共 34 行

M
34
字号
function ball_bounce()
%BALL_BOUNCE is a demo of GUI design for the book.

%designed by Professor Dingyu Xue (c), 5 April, 2000
h_main=figure('Units','normalized','Position',[0.3,0.3,0.5,0.4],...
   'MenuBar','none','Name','Bouncing Ball Demo',...
   'NumberTitle','off','Resize','off');
h_axis = axes('Units','normalized','Position',[0.12,0.15,0.60,0.7], ...
	'Tag','axMain','Visible','off','XLim',[0,1],'YLim',[-0.09,1.09]); hold on
h_button = uicontrol('Style','PushButton','Units','normalized',...
   'Position',[0.78,0.8,0.2,0.1],'String','Start',...
   'CallBack','exec_bouncing;');
h_rad1 = uicontrol('Style','RadioButton',	'Units','normalized', ...
   'Position',[0.76 0.64 0.2 0.07],'Tag','rdRadio1',...
   'BackgroundColor',[0.8,0.8,0.8],'Value',1,...
   'String','Faster','CallBack','set_speed(1);');
h_rad2 = uicontrol('Style','RadioButton',	'Units','normalized', ...
   'Position',[0.76 0.54 0.2 0.07],'Tag','rdRadio2',...
   'BackgroundColor',[0.8,0.8,0.8],...
   'String','Slower','CallBack','set_speed(2);');
h_rad3 = uicontrol('Style','RadioButton',	'Units','normalized', ...
   'Position',[0.76 0.44 0.23 0.07],'Tag','rdRadio3',...
   'BackgroundColor',[0.8,0.8,0.8],...
   'String','Default Speed','CallBack','set_speed(3);');
h_list = uicontrol('Style','ListBox',	'Units','normalized', ...
	'Position',[0.77 0.14 0.2 0.25],'String','red|green|blue', ...
	'Tag','lstColor',	'Value',2,'CallBack','set_speed(4);');
h1=line([0,1],-0.09*[1,1]); set(h1,'LineWidth',5);
h2=line([0,1],1.09*[1,1]); set(h2,'LineWidth',7);
hMarker=line([0],[1]); 
set(hMarker,'Marker','o','MarkerSize',8,'Color','g',...
   'Tag','hBall','LineWidth',5);
uu={[0,1,0],0.05,0.5}; set(h_main,'UserData',uu);

⌨️ 快捷键说明

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