?? demo1.m
字號:
%**********************
%求系統(tǒng)在狀態(tài)反饋前后的狀態(tài)變化曲線Xk(t)Xb(t)
wind_demo10=figure('color',[1,1,1],'position',[0.1*winw,0.1*winh,0.8*winw,0.8*winh],...
'name','習題演示窗口1:求系統(tǒng)在狀態(tài)反饋前后的狀態(tài)變化曲線Xk(t),Xb(t)','numbertitle','off','menubar','none',...
'resize','off','clipping','off');
color=[0.9;.9;.9];
uicontrol('style','frame','position',[0,0,1,1],...
'units','normalized','backgroundcolor',color);
pos=[0.1,0.86,0.25,0.04];
showtext(pos,color,'輸入系統(tǒng)狀態(tài)空間:');
color=[.8;.8;0.8];
uicontrol('style','frame','position',[0.095,0.6,.7,.25],...
'units','normalized','backgroundcolor',color);
pos=[0.1,0.78,0.04,0.04];
showtext(pos,color,'A:');
demo_edita=uicontrol(wind_demo10,'style','edit','pos',[0.15,0.78,0.62,0.04],...
'string','[]','back',[0,0.7,1],'units','normalized');
pos=[0.1,0.73,0.04,0.04];
showtext(pos,color,'B:');
demo_editb=uicontrol(wind_demo10,'style','edit','pos',[0.15,0.73,0.62,0.04],...
'string','[]','back',[0,0.7,1],'units','normalized');
pos=[0.1,0.68,0.04,0.04];
showtext(pos,color,'C:');
demo_editc=uicontrol(wind_demo10,'style','edit','pos',[0.15,0.68,0.62,0.04],...
'string','[]','back',[0,0.7,1],'units','normalized');
pos=[0.1,0.63,0.04,0.04];
showtext(pos,color,'D:');
demo_editd=uicontrol(wind_demo10,'style','edit','pos',[0.15,0.63,0.62,0.04],...
'string','[0]','back',[0,0.7,1],'units','normalized');
%*************
color=[.9;.9;0.9];
pos=[0.1,0.52,0.25,0.04];
showtext(pos,color,'系統(tǒng)的原極點為:');
color=[.8;.8;0.8];
uicontrol('style','frame','position',[0.095,0.45,.7,.06],...
'units','normalized','backgroundcolor',color);
pos=[0.1,0.46,0.04,0.04];
showtext(pos,color,'P:');
%*************
color=[.9;.9;0.9];
pos=[0.1,0.36,0.25,0.04];
showtext(pos,color,'系統(tǒng)希望極點為:');
color=[.8;.8;0.8];
uicontrol('style','frame','position',[0.095,0.29,.7,.06],...
'units','normalized','backgroundcolor',color);
pos=[0.1,0.3,0.04,0.04];
showtext(pos,color,'P:');
demo_editp=uicontrol(wind_demo10,'style','edit','pos',[0.15,0.3,0.62,0.04],...
'string','[]','back',[0,0.7,1],'units','normalized');
%***************
str3=['demop=eval(get(demo_editp,''string''));',...
'kk=place(demoa,demob,demop);',...
'at=demoa-demob*kk;bt=demob;ct=democ;dt=demod;',...
't=[0:0.01:10];',...
'subplot(1,2,2);',...
'[y,x]=step(at,bt,ct,dt,1,t);',...
'plot(t,y,t,x);',...
'grid;ylabel(''Y(t)和X(t)'');title(''系統(tǒng)反饋后Xk(t)'');']
str2=['t=[0:0.01:10];',...
'windstep1=figure(''color'',[0,0,0],''position'',[0.1*winw,0.1*winh,0.8*winw,0.8*winh],',...
' ''name'',''系統(tǒng)反饋前Xb(t),后Xk(t)'',''numbertitle'',''off'',''menubar'',''none'',',...
' ''resize'',''off'');',...
'subplot(1,2,1);',...
'[y,x]=step(demoa,demob,democ,demod,1,t);',...
'plot(t,y,t,x);',...
'grid;ylabel(''Y(t)和X(t'');title(''系統(tǒng)反饋前Xb(t)'');',...
'demo10_3=uicontrol(windstep1,''style'',''push'',''string'',''求Xk(t)'',',...
' ''position'',[0.3,0.05,0.15,0.06],''units'',''normalized'',''enable'',''on'',',...
' ''callback'',str3);',...
'uicontrol(windstep1,''style'',''push'',''string'',''Close'',',...
' ''position'',[0.59,0.05,0.15,0.06],''units'',''normalized'',',...
' ''callback'',''close(windstep1)'');']
str1=['set(demo10_2,''enable'',''on'');',...
'demoa=eval(get(demo_edita,''string''));demob=eval(get(demo_editb,''string''));',...
'democ=eval(get(demo_editc,''string''));demod=eval(get(demo_editd,''string''));',...
'[z,p,k]=ss2zp(demoa,demob,democ,demod,1);',...
'pos=[0.15,0.46,.62,.04];showtext(pos,color,mat2str(p));']
demo10_2=uicontrol(wind_demo10,'style','push','string','求Xb(t)',...
'position',[0.83,0.5,0.15,0.06],'units','normalized','enable','off',...
'callback',str2);
udemo10_1=uicontrol(wind_demo10,'style','push','string','原極點P',...
'position',[0.83,0.8,0.15,0.06],'units','normalized',...
'callback',str1);
uicontrol(wind_demo10,'style','push','string','Close',...
'position',[0.83,0.2,0.15,0.06],'units','normalized',...
'callback','close(wind_demo10)');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -