'for k=1:length(z);',...
'y(:,k)=step(1,[1 2*z(k) 1],t);',... 'plot(t,y(:,k));',...
'if (length(z)>1) ,hold on,end,',... 'end;',...
'hold off,']);
h_push1=uicontrol(h_fig,'style','push',...
'unit','normalized','position',[0.67,0.37,0.12,0.15],... 'string','grid on','callback','grid on'); h_push2=uicontrol(h_fig,'style','push',...
'unit','normalized','position',[0.67,0.15,0.12,0.15],... 'string','grid off','callback','grid off'); 得到以下图行
在程序“text(0.12,0.93,str,'fontsize',13); h_fig=get(H,'parent')”后面加入程序段
set(h_fig, 'MenuBar','none')
h_menu=uimenu(gcf,'label','Options');
h_sub3=uimenu(h_menu,'label','box on','callback','box on',...
16
'separator','on'); h_sub4=uimenu(h_menu,'label','box off','callback','box off');
得到以下图形
在程序'if (length(z)>1) ,hold on,end,',...; 'end;',...;'hold off,']);后面加入以下程序段
h_menu=uimenu(gcf,'label','Color');
h_submenu1=uimenu(h_menu,'label','Blue',... 'callback','set(plot(t,y),''Color'',''b'')'); h_submenu1=uimenu(h_menu,'label','Green',... 'callback','set(plot(t,y),''Color'',''g'')'); h_submenu1=uimenu(h_menu,'label','yellow',... 'callback','set(plot(t,y),''Color'',''y'')'); h_submenu1=uimenu(h_menu,'label','cyan',... 'callback','set(plot(t,y),''Color'',''c'')'); h_submenu2=uimenu(h_menu,'label','Red',... 'callback','set(plot(t,y),''color'',''r''),'); 并且输入阻尼比,就可以得到以下图像
17
2、GUI控件形式方法
(1)新建一个GUI文件完成文件的创建
18
图中的每个原始文件都以图中名称命名。
(2) 工具栏设置option、color工具,如图示
(3) 运行(1)图的时候弹出“Editor”文件,修改文件,保存为为oo.m程序,
运行程序可以得到下面图形
19

