|
|
#2
zhangenter2006-09-16 19:41
set( gcf,'position',[100 100 300 400],'menubar','none',... 'numbertitle','off','name','传递函数仿真','doublebuffer','on'); axes('position',[0.15 0.4 0.7 0.5]) uicontrol('sty','text','pos',[20 80 80 25],'str','w=','hor','right','fontsize',10); uicontrol('sty','edit','pos',[105 80 60 25],'str','','fontsize',10,'tag','edit1'); uicontrol('sty','text','pos',[20 50 80 25],'str','u=','hor','right','fontsize',10); uicontrol('sty','edit','pos',[105 50 60 25],'str','','fontsize',10,'tag','edit2'); uicontrol('sty','text','pos',[20 20 80 25],'str','仿真时间[s]','hor','right','fontsize',10); uicontrol('sty','edit','pos',[105 20 60 25],'str','','fontsize',10,'tag','edit3'); uicontrol('pos',[200 40 60 60],'str','仿真','callback',['try;wh=findobj(''tag'',''edit1'');',... 'uh=findobj(''tag'',''edit2'');w=str2num(get(wh,''string''));u=str2num(get(uh,''string''));',... 'th=findobj(''tag'',''edit3'');tmax=str2num(get(th,''string''));t=0:0.1:tmax;',... 'y=step([w^2],[1 2*w*u w^2],t);plot(t,y),catch,errordlg(''输入无效'',''错误''),end']);
顺手做个小界面玩玩,w取1,u取0.3,仿真时间20秒时候的曲线似乎还不错
|