?? demo8.m
字號:
%**********************
%求傳遞函數的最小實現
wind_demo12=figure('color',[1,1,1],'position',[0.1*winw,0.1*winh,0.8*winw,0.8*winh],...
'name','習題演示窗口8:求傳遞函數的最小實現','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.26,0.92,0.25,0.04];
showtext(pos,color,'輸入系統狀態空間');
color=[.8;.8;0.8];
uicontrol('style','frame','position',[0.035,0.65,.7,.25],...
'units','normalized','backgroundcolor',color);
pos=[0.05,0.83,0.04,0.04];
showtext(pos,color,'A:');
demo_edita=uicontrol(wind_demo12,'style','edit','pos',[0.09,0.83,0.62,0.04],...
'string','[]','back',[0,0.7,1],'units','normalized');
pos=[0.05,0.78,0.04,0.04];
showtext(pos,color,'B:');
demo_editb=uicontrol(wind_demo12,'style','edit','pos',[0.09,0.78,0.62,0.04],...
'string','[]','back',[0,0.7,1],'units','normalized');
pos=[0.05,0.73,0.04,0.04];
showtext(pos,color,'C:');
demo_editc=uicontrol(wind_demo12,'style','edit','pos',[0.09,0.73,0.62,0.04],...
'string','[]','back',[0,0.7,1],'units','normalized');
pos=[0.05,0.68,0.04,0.04];
showtext(pos,color,'D:');
demo_editd=uicontrol(wind_demo12,'style','edit','pos',[0.09,0.68,0.62,0.04],...
'string','[0]','back',[0,0.7,1],'units','normalized');
color=[.9;.9;0.9];
pos(1)=0.39;pos(2)=0.3;pos(3)=0.25;showtext(pos,color,'原傳遞函數:');
pos(1)=0.38;pos(2)=0.13;pos(3)=0.25;showtext(pos,color,'最小傳遞函數:');
pos(1)=0.38;pos(2)=0.6;pos(3)=0.25;showtext(pos,color,'最小狀態空間:');
color=[.8;.8;0.8];
uicontrol('style','frame','position',[0.032,0.18,.93,.11],...
'units','normalized','backgroundcolor',color);
uicontrol('style','frame','position',[0.032,0.35,.93,.24],...
'units','normalized','backgroundcolor',color);
uicontrol('style','frame','position',[0.032,0.01,.93,.11],...
'units','normalized','backgroundcolor',color);
str=['color=[0.8,.8,.8];',...
'demoa=eval(get(demo_edita,''string''));demob=eval(get(demo_editb,''string''));',...
'democ=eval(get(demo_editc,''string''));demod=eval(get(demo_editd,''string''));',...
'[a1,b1,c1,d1]=minreal(demoa,demob,democ,demod);',...
'[num1,den1]=ss2tf(demoa,demob,democ,demod);',...
'[num2,den2]=minreal(num1,den1);',...
'pos=[0.07,0.52,0.88,0.04];showtext(pos,color,mat2str(a1));',...
'pos=[0.07,0.47,0.88,0.04];showtext(pos,color,mat2str(b1));',...
'pos=[0.07,0.42,0.88,0.04];showtext(pos,color,mat2str(c1));',...
'pos=[0.07,0.37,0.88,0.04];showtext(pos,color,mat2str(d1));',...
'pos=[0.09,0.24,0.86,0.04];showtext(pos,color,mat2str(num1));',...
'pos=[0.09,0.19,0.86,0.04];showtext(pos,color,mat2str(den1));',...
'pos=[0.09,0.07,0.86,0.04];showtext(pos,color,mat2str(num2));',...
'pos=[0.09,0.02,0.86,0.04];showtext(pos,color,mat2str(den2));']
uicontrol(wind_demo12,'style','push','string','最小實現',...
'position',[0.8,0.8,0.14,0.06],'units','normalized',...
'callback',str);
uicontrol(wind_demo12,'style','push','string','Close',...
'position',[0.8,0.7,0.14,0.06],'units','normalized',...
'callback','close(wind_demo12)');
pos=[0.04,0.52,0.03,0.04];
showtext(pos,color,'A:');
pos=[0.04,0.47,0.03,0.04];
showtext(pos,color,'B:');
pos=[0.04,0.42,0.03,0.04];
showtext(pos,color,'C:');
pos=[0.04,0.37,0.03,0.04];
showtext(pos,color,'D:');
pos=[0.04,0.24,0.05,0.04];
showtext(pos,color,'分子:');
pos=[0.04,0.19,0.05,0.04];
showtext(pos,color,'分母:');
pos=[0.04,0.07,0.05,0.04];
showtext(pos,color,'分子:');
pos=[0.04,0.02,0.05,0.04];
showtext(pos,color,'分母:');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -