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

📄 demo9.m

📁 详细介绍了Mathlab的使用方法与技巧
💻 M
字号:
%说明增大K和L的取值对系统性能的影响
wind_demo11=figure('color',[1,1,1],'position',[0.1*winw,0.1*winh,0.8*winw,0.8*winh],...
       'name','习题演示窗口9:说明增大K和L的取值对系统性能的影响','numbertitle','off','menubar','none',...
        'resize','off','clipping','off');
color=[.9;.9;0.9];
uicontrol('style','frame','position',[0,0,1,1],...
   'units','normalized','backgroundcolor',color);
%$$$$$$$$$$$$$$$$$$
pos=[0.09,0.86,0.28,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_demo11,'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_demo11,'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_demo11,'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_demo11,'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.09,0.52,0.2,0.04];
showtext(pos,color,'系统的能控能观性为:');
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.1,0.04];
showtext(pos,color,'能控能观性:');
%*************
color=[.9;.9;0.9];
pos=[0.09,0.36,0.24,0.04];
showtext(pos,color,'任意给定状态反馈行向量K:');
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,'K:');
demo_editk=uicontrol(wind_demo11,'style','edit','pos',[0.15,0.3,0.62,0.04],...
        'string','[]','back',[0,0.7,1],'units','normalized');
%***************
color=[.9;.9;0.9];
pos=[0.09,0.2,0.24,0.04];
showtext(pos,color,'任意给定观测器列向量L:');
color=[.8;.8;0.8];
uicontrol('style','frame','position',[0.095,0.13,.7,.06],...
   'units','normalized','backgroundcolor',color);
pos=[0.1,0.14,0.04,0.04];
showtext(pos,color,'L:');
demo_editl=uicontrol(wind_demo11,'style','edit','pos',[0.15,0.14,0.62,0.04],...
        'string','[]','back',[0,0.7,1],'units','normalized');
%***************
str1=['set(udemo6_2,''enable'',''on'');',...
      'set(udemo6_3,''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''));',...
      'co1=ctrb(demoa,demob);cb1=obsv(demoa,democ);m1=rank(co1);n1=rank(cb1);[m,n]=size(demoa);',...
      'if (m1==n),if (n1==n),pos=[0.22,0.46,.5,.04];showtext(pos,color,''系统能控能观'');',...
      '                    else,pos=[0.22,0.46,.5,.04];showtext(pos,color,''系统能控不能观'');end;',...
      'else,if (n1==n),pos=[0.22,0.46,.5,.04];showtext(pos,color,''系统不能控能观'');',...
      '         else,pos=[0.22,0.46,.5,.04];showtext(pos,color,''系统不能控不能观'');end;end;']
str2=['demok1=eval(get(demo_editk,''string''));',...
      'demok2=10*demok1;demok3=1000*demok1;',...
      'ak1=demoa-demob*demok1;bk1=demob;ck1=democ;dk1=demod;',...
      'ak2=demoa-demob*demok2;bk2=demob;ck2=democ;dk2=demod;',...
      'ak3=demoa-demob*demok3;bk3=demob;ck3=democ;dk3=demod;',...
      'windstep1=figure(''color'',[0,0,0],''position'',[0.05*winw,0.05*winh,0.9*winw,0.9*winh],',...
      '                ''name'',''系统在不同状态反馈K下的状态曲线Xb(t)'',''numbertitle'',''off'',''menubar'',''none'',',...
      '                ''resize'',''off'');',...
      't=[0:0.01:10];',...
      '[yk x]=step(demoa,demob,democ,demod,1,t);',...
      '[yk1 xk1]=step(ak1,bk1,ck1,dk1,1,t);',...
      '[yk2 xk2]=step(ak2,bk2,ck2,dk2,1,t);',...
      '[yk3 xk3]=step(ak3,bk3,ck3,dk3,1,t);',...
      'subplot(2,2,1);',...
      'plot(t,yk,t,x);',...
      'grid;title(''系统原输出Y(t)和原状态Xb(t)'');',...
      'subplot(2,2,2);',...
      'plot(t,yk1,t,xk1);',...
      'grid;title(''1*K输出Y(t)和状态反馈Xb(t)'');',...
      'subplot(2,2,3);',...
      'plot(t,yk2,t,xk2);',...
      'grid;title(''10*K输出Y(t)和状态反馈Xb(t)'');',...
      'subplot(2,2,4);',...
      'plot(t,yk3,t,xk3);',...
      'grid;title(''1000*K输出Y(t)和状态反馈Xb(t)'');',...
      'uicontrol(windstep1,''style'',''push'',''string'',''Close'',',...
      '            ''position'',[0.46,0.05,0.12,0.04],''units'',''normalized'',',...
      '            ''callback'',''close(windstep1)'');']
str3=['demol1=eval(get(demo_editl,''string''));',...
      'demol2=demol1*10;demol3=demol1*1000;',...
      'al1=demoa-demol1*democ;bl1=demob;cl1=democ;dl1=demod;',...
      'al2=demoa-demol2*democ;bl2=demob;cl2=democ;dl2=demod;',...
      'al3=demoa-demol3*democ;bl3=demob;cl3=democ;dl3=demod;',...
      'windstep2=figure(''color'',[0,0,0],''position'',[0.05*winw,0.05*winh,0.9*winw,0.9*winh],',...
      '                ''name'',''系统在不同观测器反馈L下的状态曲线Xb(t)'',''numbertitle'',''off'',''menubar'',''none'',',...
      '                ''resize'',''off'');',...
      't=[0:0.01:10];',...
      '[yl x]=step(demoa,demob,democ,demod,1,t);',...
      '[yl1 xl1]=step(al1,bl1,cl1,dl1,1,t);',...
      '[yl2 xl2]=step(al2,bl2,cl2,dl2,1,t);',...
      '[yl3 xl3]=step(al3,bl3,cl3,dl3,1,t);',...
      'subplot(2,2,1);',...
      'plot(t,yl,t,x);',...
      'grid;title(''系统原输出Y(t)和原状态Xb(t)'');',...
      'subplot(2,2,2);',...
      'plot(t,yl1,t,xl1);',...
      'grid;title(''1*L输出Y(t)和状态反馈Xb(t)'');',...
      'subplot(2,2,3);',...
      'plot(t,yl2,t,xl2);',...
      'grid;title(''10*L输出Y(t)和状态反馈Xb(t)'');',...
      'subplot(2,2,4);',...
      'plot(t,yl3,t,xl3);',...
      'grid;title(''1000*L输出Y(t)和状态反馈Xb(t)'');',...
      'uicontrol(windstep2,''style'',''push'',''string'',''Close'',',...
      '            ''position'',[0.46,0.05,0.12,0.04],''units'',''normalized'',',...
      '            ''callback'',''close(windstep2)'');']
str4=['windtext=figure(''color'',[.7,1,.7],''position'',[0.2*winw,0.2*winh,0.6*winw,0.6*winh],',...
      '                ''name'',''增大K和L的影响'',''numbertitle'',''off'',''menubar'',''none'',',...
      '                ''resize'',''off'');',...
      'pos=[0.1,0.7,0.8,0.04];color=[.7,1,.7];',...
      'showtext(pos,color,''极点配置不当,将影响原系统动态性能'');',...
      'pos(2)=0.55;showtext(pos,color,''否则K和L值会很大'');',...
      'pos(2)=0.45;showtext(pos,color,''产生饱和甚至不稳定'');',... 
      'pos(2)=0.35;showtext(pos,color,''同时带宽增加,引起噪声'');',...
      'uicontrol(windtext,''style'',''push'',''string'',''Close'',',...
      '            ''position'',[0.38,0.1,0.22,0.08],''units'',''normalized'',',...
      '            ''callback'',''close(windtext)'');']
udemo6_1=uicontrol(wind_demo11,'style','push','string','能控能观性',...
       'position',[0.83,0.85,0.15,0.06],'units','normalized',...
      'callback',str1);
udemo6_2=uicontrol(wind_demo11,'style','push','string','增大K',...
       'position',[0.83,0.68,0.15,0.06],'units','normalized','enable','off',...
      'callback',str2);
udemo6_3=uicontrol(wind_demo11,'style','push','string','增大L',...
       'position',[0.83,0.51,0.15,0.06],'units','normalized','enable','off',...
      'callback',str3);
uicontrol(wind_demo11,'style','push','string','影响',...
       'position',[0.83,0.34,0.15,0.06],'units','normalized',...
      'callback',str4);
uicontrol(wind_demo11,'style','push','string','Close',...
      'position',[0.83,0.17,0.15,0.06],'units','normalized',...
      'callback','close(wind_demo11)');

⌨️ 快捷键说明

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