⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 valuta1.m

📁 vTools is a toolbox for Matlab 5.3 developed within the Department of Electrical Systems and A
💻 M
字号:
function valuta1(indice);
%VALUTA1 : grafici della finestra di evaluation
%
%
%Massimo Davini 15/02/99 --- revised 05/06/99 

% put delgraf instead of delete(findobj('tag','grafico'));
% 25/may/02 Giampy

global stack;
delgraf;
delete(findobj('tag','textgrafico'));
drawnow;

sizetext=.65;

a=findobj('tag','eva');
set(a(1:3),'visible','off');

po=findobj('string','Po = To = inv( I+GK )*GK');
pi=findobj('string','Pi = Mi =  G*inv( I+KG )');
set(pi,'foregroundcolor',[0 0 0]);
set(po,'foregroundcolor',[0 0 0]);

drawnow;

watchon;
switch indice
%-------------------------------------
% det(I+GK)=det(I+KG)
    case 1
    set(a(1:3),'visible','off');
    drawnow;   
    
    dIFo=stack.evaluation.grafici.dIFo;

    set(gca,'position',[0.15 0.27 0.7 0.63]);
    plot(real(dIFo),imag(dIFo),'r',0,0,'k+');
    
    axis([-3 3 -3 3]);
    title('det( I+GK ) = det( I+KG )','color','k','fontsize',9,'fontweight','normal');
    xlabel('Real axis','fontsize',8);ylabel('Imag axis','fontsize',8);
    set(gca,'tag','grafico');
    crea_pop(1,'crea');
    hold on;
    x=linspace(-1,1,200);
    for i=1:length(x)
      plot(x(i),sqrt(1-x(i)*x(i)),'b-',x(i),-sqrt(1-x(i)*x(i)),'b-');
    end;
    hold off;
    %-------------------------------------
% Input ant output open loop responses
    case 2
    set(a(1:3),'visible','off');
    drawnow;   
    
    w=stack.evaluation.grafici.w;
    sFi=stack.evaluation.grafici.sFi;
    sFo=stack.evaluation.grafici.sFo;
    sFiW=stack.evaluation.grafici.sFiW;
    sFoW=stack.evaluation.grafici.sFoW;

    set(gca,'position',[0.15 0.27 0.7 0.63]);
    semilogx(w,20*log10(sFi),'r',w,20*log10(sFo),'b',...
             w,20*log10(sFiW),'m',w,20*log10(sFoW),'c');
    if isnan(sFiW)&isnan(sFoW)
         title('F = GK (blue) , F = KG (red)','color','k','fontsize',9);
    else title('F = GK (blue) , F = KG (red) , weight (cyan,mag)','color','k','fontsize',9);
    end;
    xlabel('Frequency (rad/s)','fontsize',8);ylabel('dB','fontsize',8);
    set(gca,'tag','grafico');
    crea_pop(1,'crea');
    
%-------------------------------------
% Input ant output sensitivity.
    case 3
       
    set(a(1:3),'visible','off');
    drawnow;   

    w=stack.evaluation.grafici.w;
    sSi=stack.evaluation.grafici.sSi;
    sSo=stack.evaluation.grafici.sSo;
    sSiW=stack.evaluation.grafici.sSiW;
    sSoW=stack.evaluation.grafici.sSoW;

    set(gca,'position',[0.15 0.27 0.7 0.63]);
    semilogx(w,20*log10(sSi),'r',w,20*log10(sSo),'b',...
            w,20*log10(sSiW),'m',w,20*log10(sSoW),'c');
    if isnan(sSiW)&isnan(sSoW)
         title('So = inv(I+GK) (blue) , Si = inv(I+KG) (red)','color','k','fontsize',9);
    else title('So = inv(I+GK) (blue) , Si = inv(I+KG) (red) , weights (cyan,mag)','color','k','fontsize',9);
    end;
    xlabel('Frequency (rad/s)','fontsize',8);ylabel('dB','fontsize',8);
    set(gca,'tag','grafico');
    crea_pop(1,'crea');
    
%-------------------------------------
% Input and output control sensitivity.
    case 4
    set(a(1:3),'visible','off');
    drawnow;   
    
    w=stack.evaluation.grafici.w;
    sMi=stack.evaluation.grafici.sMi;
    sMo=stack.evaluation.grafici.sMo;
    sMiW=stack.evaluation.grafici.sMiW;
    sMoW=stack.evaluation.grafici.sMoW;

    set(gca,'position',[0.15 0.27 0.7 0.63]);
    semilogx(w,20*log10(sMi),'r',w,20*log10(sMo),'b',...
              w,20*log10(sMiW),'m',w,20*log10(sMoW),'c');
    if isnan(sMiW)&isnan(sMoW)
         title('Mo = K*inv(I+GK) (blue) , Mi = G*inv(I+KG) (red)','color','k','fontsize',9);
    else title('Mo = K*inv(I+GK) (b) , Mi = G*inv(I+KG) (r) , weights (cyan,mag)','color','k','fontsize',9);
    end;
    xlabel('Frequency (rad/s)','fontsize',8);ylabel('dB','fontsize',8);
    set(gca,'tag','grafico');
    crea_pop(1,'crea');
    
%-------------------------------------
% Input and output complementary sensitivity 
    case 5
    set(a(1:3),'visible','off');
    drawnow;   
    
    w=stack.evaluation.grafici.w;
    sTi=stack.evaluation.grafici.sTi;
    sTo=stack.evaluation.grafici.sTo;
    sTiW=stack.evaluation.grafici.sTiW;
    sToW=stack.evaluation.grafici.sToW;

    set(gca,'position',[0.15 0.27 0.7 0.63]);
    semilogx(w,20*log10(sTi),'r',w,20*log10(sTo),'b',...
              w,20*log10(sTiW),'m',w,20*log10(sToW),'c');
    if isnan(sTiW)&isnan(sToW)
        title('To = inv(I+GK)*GK (blue) , Ti = inv(I+KG)*KG (red)',...
          'color','k','fontsize',9);
    else title('To = inv(I+GK)*GK (b) , Ti = inv(I+KG)*KG (r) , weights (cyan,mag)',...
          'color','k','fontsize',9);
    end;
    xlabel('Frequency (rad/s)','fontsize',8);ylabel('dB','fontsize',8);
    set(gca,'tag','grafico');
    crea_pop(1,'crea');
    
%-------------------------------------
% gain and phase margins:
    case 6
    set(a(1:3),'visible','on');
    drawnow;
    
    mdo=stack.evaluation.grafici.mdo;
    pho=stack.evaluation.grafici.pho;
    gmho=stack.evaluation.grafici.gmho;
    gmlo=stack.evaluation.grafici.gmlo;
    phi=stack.evaluation.grafici.phi;
    gmhi=stack.evaluation.grafici.gmhi; 
    gmli=stack.evaluation.grafici.gmli;

    Frame=uicontrol('style','frame','units','normalized',...
       'position',[0.15 0.27 0.7 0.63],'backgroundcolor',[1 1 1],...
       'tag','textgrafico');
       
    Text(1)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.2 0.805 0.4 0.06],'backgroundcolor',[1 1 1],...
       'HorizontalAlignment','left','string','Min( abs(det(I+GK)) )',...
       'tag','textgrafico');

    Text1(1)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.6 0.805 0.2 0.06],'backgroundcolor',[1 1 1],...
       'foregroundcolor',[1 0 0],'HorizontalAlignment','right',...
       'string',num2str(mdo),'tag','textgrafico');

    Text(2)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.2 0.72 0.4 0.06],'backgroundcolor',[1 1 1],...
       'HorizontalAlignment','left','string','Output phase margin',...
       'tag','textgrafico');       
 
    Text1(2)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.6 0.72 0.2 0.06],'backgroundcolor',[1 1 1],...
       'foregroundcolor',[1 0 0],'HorizontalAlignment','right',...
       'string',num2str(pho),'tag','textgrafico');

    Text(3)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.2 0.635 0.4 0.06],'backgroundcolor',[1 1 1],...
       'HorizontalAlignment','left','string','Output max gain margin',...
       'tag','textgrafico');

    Text1(3)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.6 0.635 0.2 0.06],'backgroundcolor',[1 1 1],...
       'foregroundcolor',[1 0 0],'HorizontalAlignment','right',...
       'string',num2str(gmho),'tag','textgrafico');

    Text(4)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.2 0.55 0.4 0.06],'backgroundcolor',[1 1 1],...
       'HorizontalAlignment','left','string','Output min gain margin',...
       'tag','textgrafico');

    Text1(4)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.6 0.55 0.2 0.06],'backgroundcolor',[1 1 1],...
       'foregroundcolor',[1 0 0],'HorizontalAlignment','right',...
       'string',num2str(gmlo),'tag','textgrafico');

    Text(5)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.2 0.465 0.4 0.06],'backgroundcolor',[1 1 1],...
       'HorizontalAlignment','left','string','Input phase margin',...
       'tag','textgrafico');

    Text1(5)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.6 0.465 0.2 0.06],'backgroundcolor',[1 1 1],...
       'foregroundcolor',[1 0 0],'HorizontalAlignment','right',...
       'string',num2str(phi),'tag','textgrafico');

    Text(6)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.2 0.38 0.4 0.06],'backgroundcolor',[1 1 1],...
       'HorizontalAlignment','left','string','Input max gain margin',...
       'tag','textgrafico');

    Text1(6)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.6 0.38 0.2 0.06],'backgroundcolor',[1 1 1],...
       'foregroundcolor',[1 0 0],'HorizontalAlignment','right',...
       'string',num2str(gmhi),'tag','textgrafico');

    Text(7)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.2 0.295 0.4 0.06],'backgroundcolor',[1 1 1],...
       'HorizontalAlignment','left','string','Input min gain margin',...
       'tag','textgrafico');

    Text1(7)=uicontrol('style','text','units','normalized',...
       'fontunits','normalized','fontsize',sizetext,'fontweight','bold',...
       'position',[0.6 0.295 0.2 0.06],'backgroundcolor',[1 1 1],...
       'foregroundcolor',[1 0 0],'HorizontalAlignment','right',...
       'string',num2str(gmli),'tag','textgrafico');
    
%-------------------------------------
% PZmaps
    case 7
    set(a(1:3),'visible','on');
    drawnow;   
    
    AFo=stack.evaluation.grafici.AFo;
    BFo=stack.evaluation.grafici.BFo;
    CFo=stack.evaluation.grafici.CFo;
    DFo=stack.evaluation.grafici.DFo;
    ASo=stack.evaluation.grafici.ASo;
    BSo=stack.evaluation.grafici.BSo;
    CSo=stack.evaluation.grafici.CSo;
    DSo=stack.evaluation.grafici.DSo;
    AMo=stack.evaluation.grafici.AMo;
    BMo=stack.evaluation.grafici.BMo;
    CMo=stack.evaluation.grafici.CMo;
    DMo=stack.evaluation.grafici.DMo;
    ATo=stack.evaluation.grafici.ATo;
    BTo=stack.evaluation.grafici.BTo;
    CTo=stack.evaluation.grafici.CTo;
    DTo=stack.evaluation.grafici.DTo;

    ax(1,:)=axes('position',[.1 .67 .35 .25]);
    mypzmap(AFo,BFo,CFo,DFo);
    title('GK','color','k','fontsize',9);
    ylabel('');xlabel('');
    set(gca,'tag','grafico');
    crea_pop(1,'crea');
    
    ax(2,:)=axes('position',[.55 .67 .35 .25]);
    mypzmap(ASo,BSo,CSo,DSo);
    title('So = inv( I+GK )','color','k','fontsize',9);
    ylabel('');xlabel('');
    set(gca,'tag','grafico');
    crea_pop(1,'crea');
    
    ax(3,:)=axes('position',[.1 .25 .35 .25]);
    mypzmap(AMo,BMo,CMo,DMo);
    title('Mo = K*inv( I+GK )','color','k','fontsize',9);
    ylabel('');xlabel('');
    set(gca,'tag','grafico');
    crea_pop(1,'crea');
    
    ax(4,:)=axes('position',[.55 .25 .35 .25]);
    mypzmap(ATo,BTo,CTo,DTo);
    title('To = inv( I+GK )*GK','color','k','fontsize',9);
    xlabel('');ylabel('');
    set(gca,'tag','grafico');
    crea_pop(1,'crea');

    case 8
    set(a(1:3),'visible','on');
    drawnow;   
    
    AFi=stack.evaluation.grafici.AFi;
    BFi=stack.evaluation.grafici.BFi;
    CFi=stack.evaluation.grafici.CFi;
    DFi=stack.evaluation.grafici.DFi;
    ASi=stack.evaluation.grafici.ASi;
    BSi=stack.evaluation.grafici.BSi;
    CSi=stack.evaluation.grafici.CSi;
    DSi=stack.evaluation.grafici.DSi;
    AMi=stack.evaluation.grafici.AMi;
    BMi=stack.evaluation.grafici.BMi;
    CMi=stack.evaluation.grafici.CMi;
    DMi=stack.evaluation.grafici.DMi;
    ATi=stack.evaluation.grafici.ATi;
    BTi=stack.evaluation.grafici.BTi;
    CTi=stack.evaluation.grafici.CTi;
    DTi=stack.evaluation.grafici.DTi;
       
    ax(1,:)=axes('position',[.1 .67 .35 .25]);
    mypzmap(AFi,BFi,CFi,DFi);
    title('KG','color','k','fontsize',9);
    ylabel('');xlabel('');
    set(gca,'tag','grafico');
    crea_pop(1,'crea');
    
    ax(2,:)=axes('position',[.55 .67 .35 .25]);
    mypzmap(ASi,BSi,CSi,DSi);
    title('Si = inv( I+KG )','color','k','fontsize',9);
    xlabel('');ylabel('');
    set(gca,'tag','grafico');
    crea_pop(1,'crea');
    
    ax(3,:)=axes('position',[.1 .25 .35 .25]);
    mypzmap(AMi,BMi,CMi,DMi);
    title('Mi = G*inv( I+KG )','color','k','fontsize',9);
    ylabel('');xlabel('');
    set(gca,'tag','grafico');
    crea_pop(1,'crea');
    
    ax(4,:)=axes('position',[.55 .25 .35 .25]);
    mypzmap(ATi,BTi,CTi,DTi);
    title('Ti = inv( I+KG )*KG','color','k','fontsize',9);
    ylabel('');xlabel('');
    set(gca,'tag','grafico');
    crea_pop(1,'crea');

%-------------------------------------
% poles drifting:
    case 9
    set(a(1:3),'visible','off');
    drawnow;   
    
    Aol=stack.evaluation.grafici.Aol;
    Bol=stack.evaluation.grafici.Bol;
    Col=stack.evaluation.grafici.Col;
    Dol=stack.evaluation.grafici.Dol;
    avm=stack.evaluation.grafici.avm;
    l=stack.evaluation.grafici.l;

    set(gca,'position',[0.15 0.29 0.7 0.61]);
    set(gca,'tag','grafico');
    mypzmap(Aol,Bol,Col,Dol);hold on;
    xlabel('Real axis','fontsize',8);ylabel('Imag axis','fontsize',8)
    title('Closed loop poles drifting ( from blue to red )','color','k','fontsize',9);
    for j=1:size(avm,1),
          plot(real(avm(j,1)),imag(avm(j,1)),'b*');
          plot(real(avm(j,2:l-1)),imag(avm(j,2:l-1)),'g.');
          plot(real(avm(j,l)),imag(avm(j,l)),'r*','MarkerSize',8)
    end;
    set(gca,'tag','grafico');
    crea_pop(1,'crea');
    hold off;
 %-------------------------------------------------
 %---questa parte 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -