📄 imcmenum.m
字号:
'String','Help',...
'Callback','sayhelp(2300)');
else
% MIMO forward part controller
if any(iscellempty(Xmnummt)) | any(iscellempty(Xmdenmt))
errordlg('The model was not properly assigned');
return
end
if all(~iscellempty(q))
temp=questdlg('The controller was assigned, would you like to re-invert the model?',...
'Whoops!!','No');
switch temp
case 'Yes'
[qnummt,qdenmt,qdeadmt,Gnum,dec_M,input_delay,n_dec,TR,TL]=decouple(...
Xmnummt,Xmdenmt,Xmdeadmt,y);
not_save_yet=1;
set(main_fig,'Name',['Internal Model Control Tuning - [' datadir NAMEFILE '*]']);
set(current_obj,'BackgroundColor',192/255*[1 1 1]);
end
else
[qnummt,qdenmt,qdeadmt,Gnum,dec_M,input_delay,n_dec,TR,TL]=decouple(...
Xmnummt,Xmdenmt,Xmdeadmt,y);
not_save_yet=1;
set(main_fig,'Name',['Internal Model Control Tuning - [' datadir NAMEFILE '*]']);
set(current_obj,'BackgroundColor',192/255*[1 1 1]);
end
if isempty(n_dec) n_dec=maxcol; end
[f]=crfig(50,50,450,340,'Forward Path Controller --> MSF controller',192/255*[1 1 1],'none','off');
set(f,'UserData',{[row col p_index],current_obj});
set(f,'DeleteFcn','clear M_handle;');
uicontrol(f,...
'Style','text',...
'Position',[20 215 170 23],...
'Backgroundcolor',192/255*[1 1 1],...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','A vector of required input-delays :');
uicontrol(f,...
'Style','frame',...
'Position',[190 217 200 24],...
'Foregroundcolor','k');
uicontrol(f,...
'Style','edit',...
'Position',[195 220 190 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'Enable','off',...
'String',num2str(input_delay),...
'UserData',[12],...
'Callback','');
uicontrol(f,...
'Style','text',...
'Position',[20 185 170 23],...
'Backgroundcolor',192/255*[1 1 1],...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','The decoupling delay matrix (M+)');
uicontrol(f,...
'Style','frame',...
'Position',[190 187 200 24],...
'Foregroundcolor','k');
uicontrol(f,...
'Style','edit',...
'Position',[195 190 190 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'Enable','off',...
'String',num2str(dec_M),...
'UserData',[12],...
'Callback','');
temp1=zeros(maxrow,maxcol);
for i=1:maxrow
for j=1:maxcol
temp1(i,j)=length(mt2poly(qdenmt{i,j},y))-length(mt2poly(qnummt{i,j},y));
qnum{i,j}=mtx2str(qnummt{i,j},2);
if isempty(qnum{i,j})
qnum{i,j}='0';
end
qnums{i,j}=num2str(qnummt{i,j});
qden{i,j}=mtx2str(qdenmt{i,j},2);
qdens{i,j}=num2str(qdenmt{i,j});
qdead{i,j}=mtx2str(qdeadmt{i,j},4);
qdeads{i,j,1,1}=num2str(qdeadmt{i,j});
if isempty(qden{i,j}) | (length(qdenmt{i,j})==1 & ...
mt2poly(qdenmt{i,j},y)==1)
if isempty(qdead{i,j})
q{i,j,1}=qnum{i,j};
else
q{i,j,1}=[qnum{i,j} '*' qdead{i,j}];
end
else
temp=['(' qden{i,j} ')'];
if isempty(qdead{i,j})
q{i,j,1}=[qnum{i,j} '/' temp];
else
q{i,j,1}=[qnum{i,j} '/' temp '*' qdead{i,j}];
end
end
end
end
order=max(temp1);
uicontrol(f,...
'Style','text',...
'Position',[20 75 180 25],...
'Backgroundcolor',192/255*[1 1 1],...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','The part of model to be inverted (M-)');
M_handle=Xuiarray([235 65 110 50],maxrow,maxcol,0,0,...
'push','p_index=1;imcmenuM;','',q,3200,f);
uicontrol(f,...
'Style','text',...
'Position',[20 155 170 23],...
'Backgroundcolor',192/255*[1 1 1],...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','Order of the diagonal filter :');
uicontrol(f,...
'Style','frame',...
'Position',[190 157 200 24],...
'Foregroundcolor','k');
order_handle=uicontrol(f,...
'Style','edit',...
'Position',[195 160 190 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'String',num2str(order),...
'UserData',[12],...
'Callback','');
uicontrol(f,...
'Style','text',...
'Position',[20 125 170 23],...
'Backgroundcolor',192/255*[1 1 1],...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','Diagonal filter time constants :');
uicontrol(f,...
'Style','frame',...
'Position',[190 127 200 24],...
'Foregroundcolor','k');
if length(Epsilon{1}) < maxcol
Epsilon{1}(2:maxcol)=Epsilon{1}(1);
end
E_handle=uicontrol(f,...
'Style','edit',...
'Position',[195 130 190 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'String',num2str(Epsilon{1}),...
'UserData',[12],...
'Callback','Epsilon{1}=str2num(get(gco,''String''));');
uicontrol(f,...
'Style','push',...
'Position',[40 20 100 25],...
'Backgroundcolor',192/255*[1 1 1],...
'String','Nyquist Test',...
'Callback',['[n_circle]=detect_RHPZ(qnummt(1:n_dec,1:n_dec),',...
'qdenmt(1:n_dec,1:n_dec),qdeadmt(1:n_dec,1:n_dec),1);']);
uicontrol(f,...
'Style','push',...
'Position',[180 20 80 25],...
'Backgroundcolor',192/255*[1 1 1],...
'String','Done',...
'UserData',[3],...
'Callback','cbackM;');
uicontrol(f,...
'Style','push',...
'Position',[300 20 80 25],...
'Backgroundcolor',192/255*[1 1 1],...
'String',' Cancel',...
'Callback','close');
end
case 3200 % Part of model to be inverted for the MIMO system
[f]=crfig(50,50,520,300,['Part of model to be inverted (',num2str(row),',',...
num2str(col),')'],'w','none','off');
set(f,'UserData',{[row col p_index],current_obj});
uicontrol(f,...
'Style','text',...
'Position',[20 230 400 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','Model (edit) = --------------------------------------------------------------------------------');
uicontrol(f,...
'Style','text',...
'Position',[20 120 200 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','Current model:');
uicontrol(f,...
'Style','text',...
'Position',[100 110 400 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','-------------------------------------------------------------------------------------');
uicontrol(f,'Style','edit',...
'Position',[100 125 296 20],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'String',qnum{row,col,1,1});
uicontrol(f,'Style','edit',...
'Position',[100 95 296 20],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Center',...
'String',qden{row,col,1,1});
uicontrol(f,'Style','edit',...
'Position',[415 110 100 20],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'Enable','off',...
'HorizontalAlignment','Left',...
'String',qdead{row,col,1,1});
uicontrol(f,...
'Style','frame',...
'Position',[100 250 296 24],...
'Backgroundcolor','w',...
'Foregroundcolor','k');
uicontrol(f,...
'Style','edit',...
'Position',[105 253 286 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'String',qnums{row,col,1,1},...
'UserData',[8],...
'Callback',['TF_index=1;cbackM']);
uicontrol(f,...
'Style','frame',...
'Position',[100 205 296 24],...
'Backgroundcolor','w',...
'Foregroundcolor','k');
uicontrol(f,...
'Style','edit',...
'Position',[105 208 286 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'String',qdens{row,col,1,1},...
'UserData',[6],...
'Callback',['TF_index=1;cbackM']);
uicontrol(f,...
'Style','frame',...
'Position',[420 228 80 24],...
'Backgroundcolor','w',...
'Foregroundcolor','k');
uicontrol(f,...
'Style','edit',...
'Position',[425 231 70 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'String',qdeads{row,col,1,1},...
'Enable','off');
uicontrol(f,...
'Style','push',...
'Position',[100 20 80 25],...
'String','OK',...
'UserData',[3],...
'Callback',['TF_index=1;cbackM']);
uicontrol(f,...
'Style','push',...
'Position',[220 20 80 25],...
'String',' Cancel',...
'Callback','close');
case 3210
if row~=col
return
end
[f]=crfig(50,50,460,300,['model of Pd lag (',num2str(row),',',...
num2str(col),')'],'w','none','off');
set(f,'UserData',{[row col p_index],current_obj});
uicontrol(f,...
'Style','text',...
'Position',[20 230 400 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','Pd* (edit) = --------------------------------------------------------------------------------');
uicontrol(f,...
'Style','text',...
'Position',[20 120 200 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','Current Pd* :');
uicontrol(f,...
'Style','text',...
'Position',[100 110 400 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','-------------------------------------------------------------------------------------');
uicontrol(f,'Style','edit',...
'Position',[100 125 296 20],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'String','1');
uicontrol(f,'Style','edit',...
'Position',[100 95 296 20],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Center',...
'String',mtx2str(pd_prime{row,col,1,1},2));
uicontrol(f,...
'Style','frame',...
'Position',[100 250 296 24],...
'Backgroundcolor','w',...
'Foregroundcolor','k');
uicontrol(f,...
'Style','edit',...
'Position',[105 253 286 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'String','1',...
'UserData',[8],...
'Callback','');
uicontrol(f,...
'Style','frame',...
'Position',[100 205 296 24],...
'Backgroundcolor','w',...
'Foregroundcolor','k');
uicontrol(f,...
'Style','edit',...
'Position',[105 208 286 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'String',num2str(pd_prime{row,col,1,1}),...
'UserData',[6],...
'Callback',['TF_index=1;cbackM']);
uicontrol(f,...
'Style','push',...
'Position',[100 20 80 25],...
'String','OK',...
'UserData',[3],...
'Callback',['TF_index=1;cbackM']);
uicontrol(f,...
'Style','push',...
'Position',[220 20 80 25],...
'String',' Cancel',...
'Callback','close');
case 3220
for i=1:maxcol
temp=mq_gen(1,1,dec_M(i),1,1,order(i),y);
[qd{i,i},qdnum{i,i},qdden{i,i}]=qd_mat(pd_prime{i,i},temp,Epsilon{2}(i),order(i),y);
temp=strrep(qd{i,i},'e',num2str(Epsilon{2}(i)));
qd{i,i}=strrep(qd{i,i},'e',['e(' num2str(i) ')']);
set(QD_handle(maxcol*(i-1)+i),'tooltipstring',temp);
end
view_MIMO_qd;
case 2500 % Feedback part controller
if maxrow<=1 & maxcol<=1
[f]=crfig(50,50,520,300,'Feedback Path Controller','w','none','off');
set(f,'UserData',{[row col p_index],current_obj});
uicontrol(f,...
'Style','text',...
'Position',[20 250 400 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','Invert (edit) : ------------------------------------------------------------------------------------- ');
uicontrol(f,...
'Style','text',...
'Position',[25 50 200 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','(Feedback path controller = q*qd )');
uicontrol(f,...
'Style','text',...
'Position',[50 85 200 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','q = ');
uicontrol(f,...
'Style','text',...
'Position',[105 85 400 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','---------------------------------------------------------------------------');
uicontrol(f,...
'Style','text',...
'Position',[20 190 130 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','Order of the filter:');
uicontrol(f,...
'Style','text',...
'Position',[230 190 100 18],...
'Backgroundcolor','w',...
'Foregroundcolor','k',...
'HorizontalAlignment','Left',...
'String','Filter time constant:');
uicontrol(f,...
'Style','frame',...
'Position',[330 187 70 24],...
'Backgroundcolor','w',...
'Foregroundcolor','k');
if length(Epsilon{row,col})==1
Epsilon{row,col}=[Epsilon{row,col} Epsilon{row,col}];
end
uicontrol(f,...
'Style','edit',...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -