Matlab 编程指南阅读笔记- 2018/8/6

本文分享了一段MATLAB编程指南中的图形用户界面演示代码,通过.m文件创建GUI对象,实现二阶系统阶跃响应曲线的动态展示及网格开关功能。
clf reset
H=axes('unit','normalized','position',[0,0,1,1],'visible','off');
set(gcf,'currentaxes',H);
str='\fontname{隶书}归一化二阶系统的阶跃响应曲线';
text(0.12,0.93,str,'fontsize',13);
h_fig=get(H,'parent');
set(h_fig,'unit','normalized','position',[0.1,0.2,0.7,0.4]);
h_axes=axes('parent',h_fig,'unit','normalized','position',[0.1,0.15,0.55,0.7],...
'xlim',[0 15],'ylim',[0 1.8],'fontsize',8);

h_text=uicontrol(h_fig,'style','text',...
'unit','normalized','position',[0.67,0.73,0.25,0.14],...
'horizontal','left','string',{'输入阻尼比系数','zeta='});
h_edit=uicontrol(h_fig,'style','edit',...
'unit','normalized','position',[0.67,0.59,0.25,0.14],...
 'horizontal','left',...
 'callback',[...
 'z=str2num(get(gcbo,''string''));',...
  't=0:0.1:15;',...
  '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');
    

最近在读MATLAB编程指南,这段代码是第15章 图形用户界面中的演示代码。

代码主要实现利用.m文件创建GUI对象,具体代码的细节还没有完全明白。这里暂时只是驸一下代码和演示结果,期待后期陆续的更新。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值