📄 demo3.m
字号:
%判断系统的稳定性
wind_demo3=figure('color',[1,1,1],'position',[0.2*winw,0.3*winh,0.6*winw,0.4*winh],...
'name','习题演示窗口3:用Lyapunov判据确定系统的稳定性','numbertitle','off','menubar','none',...
'resize','off','clipping','off');
color=[.9;0.9;0.9];
key=0;
uicontrol('style','frame','position',[0,0,1,1],...
'units','normalized','backgroundcolor',color);
pos=[0.01,0.78,0.25,0.07];
showtext(pos,color,'输入系统状态空间:');
color=[.8;.8;0.8];
uicontrol('style','frame','position',[0.025,0.62,.7,.12],...
'units','normalized','backgroundcolor',color);
pos=[0.03,0.64,0.04,0.08];
showtext(pos,color,'A:');
demo_edita=uicontrol(wind_demo3,'style','edit','pos',[0.08,0.64,0.63,0.08],...
'string','[]','back',[0,0.7,1],'units','normalized');
color=[.9;.9;0.9];
pos=[0.01,0.5,0.22,0.07];
showtext(pos,color,'系统测试结果为:');
color=[.8;.8;0.8];
uicontrol('style','frame','position',[0.025,0.09,.95,.35],...
'units','normalized','backgroundcolor',color);
str=['demoa=eval(get(demo_edita,''string''));',...
'z=eye(size(demoa));',...
'x=lyap(demoa,z);t=0;',...
'for i=1:size(demoa)',...
' if (det(x(1:i,1:i))<0),t=1;break;end;',...
'end;',...
'if (t==1),pos=[0.04,0.22,0.92,0.08];showtext(pos,color,'' 系统不稳定! '');',...
' else,pos=[0.04,0.22,0.92,0.08];showtext(pos,color,''系统渐近稳定!'');',...
'end']
uicontrol(wind_demo3,'style','push','string','Ok',...
'position',[0.78,0.75,0.16,0.11],'units','normalized',...
'callback',str);
uicontrol(wind_demo3,'style','push','string','Close',...
'position',[0.78,0.55,0.16,0.11],'units','normalized',...
'callback','close(wind_demo3)');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -