Code covered by the BSD License  

Highlights from
MIMOtool

image thumbnail

MIMOtool

by

 

12 Nov 2001 (Updated )

Multi Input Multi Output Systems Toolbox

ea_01;
function ea_01;
%ea_01: seconda finestra della sintesi eig/assign
%
%Massimo Davini 17/04/2000

global stack;
%controllo sul numero di autovalori richiesti
campoedit=findobj('tag','ea0_edit');
num=str2num(get(campoedit,'string'));
if isempty(num)|(~isreal(num))|(num<1)|(num>size(stack.general.A,1))
   set(campoedit,'string',num2str(size(stack.general.A,1)));
   return;
end;
   
%tipo di feedback law
if     get(findobj('tag','eaopt1'),'value') tipo=1;  %state-feedback
elseif get(findobj('tag','eaopt2'),'value') tipo=2;  %output-feedback
elseif get(findobj('tag','eaopt3'),'value') tipo=3;  %constrained-feedback
end;
   
if tipo==2 ea_1;return;end;  %output feedback
  
set(stack.temp.handles,'visible','off');
drawnow;
prec=length(stack.temp.handles);

% enlarge text if java machine is running
jsz=stack.general.javasize;

st=jsz/3+.2;sf=jsz/3+.55;

if tipo==1    %state-feedback
   
  Nota(1)=uicontrol('style','frame',...
   'units','normalized','position',[0.1 0.29 0.8 0.58],...
   'backgroundcolor',[1 1 1],'visible','off','tag','ea01');

  str=['The STATE FEEDBACK controller Ksf ',...
      'that you will design in this section will be remapped',...
      ' into an OUTPUT FEEDBACK controller Kof, according to the following law:'];
  Nota(2)=uicontrol('style','text','units',...
   'normalized','position',[.13 .69 .74 0.15],...
   'fontunits','normalized','fontsize',st,'fontweight','bold',...
   'backgroundcolor',[1 1 1],'visible','off',...
   'HorizontalAlignment','left','tag','ea01','string',str);

  Nota(3)=uicontrol('style','text',...
   'units','normalized','position',[.13 .58 .74 0.07],...
   'fontunits','normalized','fontsize',sf,'fontweight','bold',...
   'backgroundcolor',[1 1 1],'foregroundcolor',[1 0 0],...
   'visible','off','HorizontalAlignment','center','tag','ea01',...
   'string','Kof = Ksf * pinv( C - D*Ksf )');
   
  Nota(4)=uicontrol('style','text',...
   'units','normalized','position',[.13 .46 .74 0.1],...
   'fontunits','normalized','fontsize',st+0.15,'fontweight','bold',...
   'backgroundcolor',[1 1 1],'visible','off',...
   'HorizontalAlignment','left','tag','ea01',... 
   'string',sprintf('therefore a true STATE FEEDBACK behaviour will be obtained when C = I and D = 0 .'));
   
  Nota(5)=uicontrol('style','text',...
   'units','normalized','position',[.13 .32 .74 0.1],...
   'fontunits','normalized','fontsize',st+.15,...
   'backgroundcolor',[1 1 1],'visible','off','foregroundcolor',[0 0 1],...
   'HorizontalAlignment','left','tag','ea01',... 
   'fontweight','bold',...
   'string','Note : in order to set the matrices C = I and D = 0 you can use the Tools menu in the Modeling section.');

   stack.temp.handles=[stack.temp.handles,Nota];
   
elseif tipo==3
    
   Nota(1)=uicontrol('style','text','units',...
    'normalized','position',[.05 .87 .9 0.05],...
    'fontunits','normalized','fontsize',jsz+0.6,'fontweight','bold',...
    'backgroundcolor',[.6 .7 .9],'visible','off',...
    'HorizontalAlignment','left','tag','ea01',...
    'string','CONSTRAINT MATRIX:');
   drawnow;
 
   KVIN=NaN*ones(size(stack.general.B,2),size(stack.general.C,1));
   [row column]=size(KVIN);
   
   for i=1:row ,for j=1:column
     if (column>4)
         lar=(0.9-0.02*(column-1))/column;
         pos=[.05+(lar+0.02)*(j-1) .85-i*.065 lar .055];
     else
         pos=[.05+0.12*(j-1) .85-i*.065 .1 .055];
    end;
       
     str=num2str(KVIN(i,j));
     coeff(i,j)=uicontrol('style','edit','units','normalized',...
         'position',pos,'tag','mat','string',str,...
         'fontunits','normalized','fontsize',0.6+jsz*0.8,'fontweight','bold',...
         'Horizontalalignment','left','backgroundcolor',[1 1 1]);
   end ,end;

   Nota(2)=uicontrol('style','text','units',...
    'normalized','position',[.36 .03 .43 0.14],...
    'fontunits','normalized','fontsize',.2857,'fontweight','bold',...
    'backgroundcolor',[.6 .7 .9],'visible','off',...
    'HorizontalAlignment','left','tag','ea01',...
    'string','Insert the contraints of the output feedback matrix as fixed zeros.');

   stack.temp.handles=[stack.temp.handles,Nota];
   for i=1:row, stack.temp.handles=[stack.temp.handles,coeff(i,:)];end;
   
end;

ea(1)=uicontrol('style','push','unit','normalized','position',[0.05 0.05 0.14 0.12],...
   'fontunits','normalized','fontsize',.35,'fontweight','bold',...
   'string','BACK','Horizontalalignment','center','tag','ea01',...
   'TooltipString','Back to the previous window',...
   'callback',sprintf('back_syn(''ea0'',%u);',prec));

ea(2)=uicontrol('style','push','unit','normalized','position',[0.2 0.05 0.14 0.12],...
   'fontunits','normalized','fontsize',.35,'fontweight','bold',...
   'string','CLOSE','Horizontalalignment','center','tag','ea01',...
   'TooltipString','Back to the main SYNTHESIS window',...
   'callback','back_syn(''syn0'',0);');

ea(3)=uicontrol('style','push','unit','normalized','position',[0.81 0.05 0.14 0.12],...
   'fontunits','normalized','fontsize',.35,'fontweight','bold',...
   'Horizontalalignment','center','string','NEXT','tag','ea01',...
   'TooltipString','Go to the next window','callback','ea_1;');

set(findobj('tag','ea01'),'visible','on');

%aggiornamento handles temporanei
stack.temp.handles=[stack.temp.handles,ea];

Contact us