⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demo8.m

📁 详细介绍了Mathlab的使用方法与技巧
💻 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 + -