?? demo9.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 + -