📄 showmsf2dfdiag.m
字号:
function [diag_handle]=msf2dfdiag(fig_handle,maxrow,maxcol,pnummt,pdnummt,model,...
Ksp,d_through_p,input_delay,Ks,Ds,qd,prefil,Epsilon)
% This function will show 1-degree of freedom IMC diagram for multivariable system
temp=maxrow*maxcol;
diag_handle=zeros(1,8*temp+33);
diag_handle(8*temp+25)=uicontrol(fig_handle,...
'Style','text',...
'Position',[150 160 450 22],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',14,...
'HorizontalAlignment','Left',...
'String','Two-degree of freedom MSF diagram');
diag_handle(8*temp+24)=uicontrol(fig_handle,...
'Style','text',...
'Position',[527 358 50 24],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',14,...
'HorizontalAlignment','Left',...
'String','> y');
diag_handle(8*temp+23)=uicontrol(fig_handle,...
'Style','text',...
'Position',[478 377 30 18],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',14,...
'HorizontalAlignment','Left',...
'String','v +');
diag_handle(8*temp+22)=uicontrol(fig_handle,...
'Style','text',...
'Position',[408 425 30 20],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',14,...
'HorizontalAlignment','Left',...
'String','d');
diag_handle(8*temp+21)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[425 428 40 5]);
diag_handle(8*temp+20)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[480 384 5 35]);
diag_handle(8*temp+19)=uicontrol(fig_handle,...
'Style','text',...
'Position',[485 294 18 18],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',14,...
'HorizontalAlignment','Left',...
'String','>');
diag_handle(8*temp+18)=uicontrol(fig_handle,...
'Style','text',...
'Position',[484 307 18 18],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',14,...
'HorizontalAlignment','Left',...
'String','-');
diag_handle(8*temp+17)=uicontrol(fig_handle,...
'Style','text',...
'Position',[148 349 40 18],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',14,...
'HorizontalAlignment','Left',...
'String','/\ -');
diag_handle(8*temp+16)=uicontrol(fig_handle,...
'Style','text',...
'Position',[20 360 40 24],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',14,...
'HorizontalAlignment','Left',...
'String','r');
diag_handle(8*temp+13)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[374 300 5 68]);
diag_handle(8*temp+15)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[30 367 500 5]);
diag_handle(8*temp+14)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[259 297 229 5]);
diag_handle(8*temp+12)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[475 362 15 15]);
diag_handle(8*temp+11)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[500 238 5 130]);
diag_handle(8*temp+10)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[495 292 15 15]);
diag_handle(8*temp+9)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[150 238 351 5]);
diag_handle(8*temp+8)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[150 242 5 110]);
diag_handle(8*temp+7)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[145 362 15 15]);
diag_handle(8*temp+6)=uicontrol(fig_handle,...
'Style','text',...
'Position',[390 330 80 24],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',13,...
'HorizontalAlignment','center',...
'String','Process');
diag_handle(8*temp+5)=uicontrol(fig_handle,...
'Style','text',...
'Position',[400 260 60 24],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',13,...
'HorizontalAlignment','center',...
'String','Model');
diag_handle(8*temp+27)=uicontrol(fig_handle,...
'Style','text',...
'Position',[305 260 60 24],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',13,...
'HorizontalAlignment','center',...
'String','I/D(s)');
diag_handle(8*temp+28)=uicontrol(fig_handle,...
'Style','text',...
'Position',[235 260 60 24],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',13,...
'HorizontalAlignment','center',...
'String','K(s)');
diag_handle(8*temp+29)=uicontrol(fig_handle,...
'Style','text',...
'Position',[260 349 40 18],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',14,...
'HorizontalAlignment','Left',...
'String','/\ -');
diag_handle(8*temp+30)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[262 300 5 52]);
diag_handle(8*temp+31)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[257 362 15 15]);
diag_handle(8*temp+4)=uicontrol(fig_handle,...
'Style','text',...
'Position',[180 330 60 24],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',13,...
'HorizontalAlignment','center',...
'String','Ksp');
diag_handle(8*temp+32)=uicontrol(fig_handle,...
'Style','text',...
'Position',[60 330 60 24],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',13,...
'HorizontalAlignment','center',...
'String','Prefilter');
diag_handle(8*temp+33)=uicontrol(fig_handle,...
'Style','text',...
'Position',[180 200 60 24],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',13,...
'HorizontalAlignment','center',...
'String','qd(s)');
diag_handle(8*temp+2)=uicontrol(fig_handle,...
'Style','text',...
'Position',[515 420 60 24],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',13,...
'HorizontalAlignment','Left',...
'String','Pd');
diag_handle(8*temp+26)=uicontrol(fig_handle,...
'Style','push',...
'Position',[320 355 38 30],...
'String','Delay',...
'TooltipString',['[ ' num2str(input_delay) ' ]'],...
'Callback','msgbox([''[ '' num2str(input_delay) '' ]''],''TimeDelay'');');
diag_handle(8*temp+1)=uicontrol(fig_handle,...
'Style','push',...
'Position',[410 55 120 30],...
'String','Show IMC diagram',...
'Callback',['delete(diag_handle(ishandle(diag_handle))); [diag_handle]=show2dfdiag(main_fig,',...
'maxrow,maxcol,p,pd,m,q,qdnum,d_through_p,input_delay);']);
diag_handle(8*temp+3)=uicontrol(fig_handle,...
'Style','push',...
'Position',[285 355 30 30],...
'String','Sat',...
'Callback','IMENU=2600;imcmenu;');
if maxrow == 1 | all(input_delay==0)
set(diag_handle(8*temp+26),'Visible','off');
set(diag_handle(8*temp+3),'Position',[305 355 35 30]);
end
diag_handle(1:temp)=Xuiarray([390 350 80 40],maxrow,maxcol,0,0,...
'push','p_index=1;imcmenuM;','',pnummt,2100,fig_handle);
diag_handle(temp+1:2*temp)=Xuiarray([390 280 80 40],maxrow,maxcol,0,0,...
'push','p_index=1;imcmenuM;','',model,2200,fig_handle);
diag_handle(3*temp+1:4*temp)=Xuiarray([180 350 60 40],maxrow,maxcol,0,0,...
'push','p_index=1;view_MIMO_MSF;','',Ksp,3600,fig_handle);
diag_handle(2*temp+1:3*temp)=Xuiarray([455 410 55 40],maxrow,maxcol,0,0,...
'push','p_index=1;imcmenuM;','',pdnummt,2400,fig_handle);
diag_handle(4*temp+1:5*temp)=Xuiarray([305 280 60 40],maxrow,maxcol,0,0,...
'push','p_index=1;view_MIMO_MSF;','',Ds,3400,fig_handle);
diag_handle(5*temp+1:6*temp)=Xuiarray([235 280 60 40],maxrow,maxcol,0,0,...
'push','p_index=1;view_MIMO_MSF;','',Ks,3500,fig_handle);
qdtemp=cell(maxrow,maxcol);
for i=1:maxcol
if i<=max(size(qd))
qdtemp{i,i}=strrep(qd{i,i},'e',num2str(Epsilon{2}(i)));
else
qdtemp{i,i}='';
end
end
diag_handle(6*temp+1:7*temp)=Xuiarray([180 220 60 40],maxrow,maxcol,0,0,...
'push','p_index=1;view_MIMO_qd;','',qdtemp,3220,fig_handle);
diag_handle(7*temp+1:8*temp)=Xuiarray([60 350 60 40],maxrow,maxcol,0,0,...
'push','p_index=1;imcmenuM;','',prefil,3230,fig_handle);
if d_through_p
for i=2*temp+1:3*temp
set(diag_handle(i),'Visible','off');
end
set(diag_handle(8*temp+2),'Visible','off');
set(diag_handle(8*temp+23),'Visible','off');
set(diag_handle(8*temp+22),'Visible','off');
set(diag_handle(8*temp+21),'Visible','off');
set(diag_handle(8*temp+20),'Visible','off');
set(diag_handle(8*temp+12),'Visible','off');
diag_handle(8*temp+34)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[355 362 15 15]);
diag_handle(8*temp+35)=uicontrol(fig_handle,...
'Style','text',...
'Position',[347 377 25 18],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',14,...
'HorizontalAlignment','Left',...
'String','+v');
diag_handle(8*temp+36)=uicontrol(fig_handle,...
'Style','frame',...
'Position',[360 384 5 35]);
diag_handle(8*temp+37)=uicontrol(fig_handle,...
'Style','text',...
'Position',[358 425 30 20],...
'Backgroundcolor','k',...
'Foregroundcolor',[.78 .78 .78],...
'FontSize',14,...
'HorizontalAlignment','Left',...
'String','d');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -