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

📄 demo4.m

📁 详细介绍了Mathlab的使用方法与技巧
💻 M
字号:
%**********************
%判断系统的能控能观性
wind_demo4=figure('color',[1,1,1],'position',[0.1*winw,0.1*winh,0.8*winw,0.8*winh],...
       'name','习题演示窗口4:判断系统的能控能观性','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.87,0.2,0.04];
showtext(pos,color,'输入系统状态空间:');
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_demo4,'style','edit','pos',[0.13,0.78,0.65,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_demo4,'style','edit','pos',[0.13,0.73,0.65,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_demo4,'style','edit','pos',[0.13,0.68,0.65,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_demo4,'style','edit','pos',[0.13,0.63,0.65,0.04],...
        'string','[0]','back',[0,0.7,1],'units','normalized');
color=[.9;.9;0.9];
pos=[0.1,0.52,0.12,0.04];
showtext(pos,color,'测试结果:');
color=[.8;.8;0.8];
uicontrol('style','frame','position',[0.095,0.1,.8,.4],...
   'units','normalized','backgroundcolor',color);
pos=[0.15,0.37,0.06,0.04];
showtext(pos,color,'A阶数:');
pos=[0.33,0.37,0.16,0.04];
showtext(pos,color,'能控判断矩阵秩:');
pos=[0.63,0.37,0.16,0.04];
showtext(pos,color,'能观判断矩阵秩:');
str=['color=[.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''));',...
      'co=ctrb(demoa,demob);cb=obsv(demoa,democ);',...
      'rco=rank(co);rcb=rank(cb);[m,n]=size(demoa);',...
      'pos=[0.21,0.39,0.04,0.03];showtext(pos,color,mat2str(m));',...
      'pos=[0.48,0.39,0.04,0.03];showtext(pos,color,mat2str(rco));',...
      'pos=[0.79,0.39,0.04,0.03];showtext(pos,color,mat2str(rcb));',...
      'if (rco==n),if (rcb==n),pos=[0.11,0.26,0.77,0.04];showtext(pos,color,''因为enable cortorl和enable observe判断矩阵的秩=A的阶数'');',...
      '                                  pos=[0.11,0.17,0.77,0.04];showtext(pos,color,''所以系统即能控又能观'');',...
      '                 else,pos=[0.11,0.26,0.77,0.04];showtext(pos,color,''因为enable observe判断矩阵的秩!=A的阶数'');',...
      '                         pos=[0.11,0.17,0.77,0.04];showtext(pos,color,''所以系统能控不能观''); end;',...
      'else,if (rcb==n),pos=[0.11,0.26,0.77,0.04];showtext(pos,color,''因为enable cortorl判断矩阵的秩!=A的阶数'');',...
      '                         pos=[0.11,0.17,0.77,0.04];showtext(pos,color,''所以系统不能控能观'');',...
      '        else,pos=[0.11,0.26,0.77,0.04];showtext(pos,color,''因为enable cortorl和enable observe判断矩阵的秩!=A的阶数'');',...
      '                pos=[0.11,0.17,0.77,0.04];showtext(pos,color,''所以系统不能控不能观'');end; end;']
uicontrol(wind_demo4,'style','push','string','Test',...
       'position',[0.83,0.8,0.14,0.06],'units','normalized',...
      'callback',str);
uicontrol(wind_demo4,'style','push','string','Close',...
       'position',[0.83,0.6,0.14,0.06],'units','normalized',...
      'callback','close(wind_demo4)');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -