www.pudn.com > Closid30.rar > CLMODEV.M, change:1998-09-14,size:26798b


function clmodev(option) 
% function clmodev(option) 
% 
% Closed loop model evaluation using highlighted plant model and controller 
% Options: 
% 1. closed-loop frequency response 
% 2. closed-loop poles 
% 3. input and output simulation 
% 4. residual test 
% 5. closed-loop step response 
% 6. plant frequency response 
% 7. plant pole-zeros 
 
% Functions called: clsetcol,clerrdia,clobjget 
 
% 01-11-1996 
% (c) Edwin van Donkelaar, Paul Van den Hof 
% Mechanical Engineering Systems and Control Group 
% Delft University of Technology 
% Last update: 12-06-1997 
%              24-08-1998: correction in f-resp calculation to handle sampling 
%                          intervals unequal to 1.  
%              14-09-1998: set default axes properties to draw a white box. 
%************************************************************************** 
 
global CLIDmods CLIDscrz CLIDevas 
 
z=CLIDscrz; 
 
% Colors 
[frmcol,txtcol,edicol,pshcol,radcol,axscol,c7,c8,c9,c10,... 
modcol,edtcol,pubcol,putcol,chbcol,chtcol,txbcol,pstcol]=clsetcol; 
 
% Total number of models, active and indices  
allmodels=CLIDmods(7,:); 
totmod=sum(CLIDmods(7,:)); 
modact=find(CLIDmods(7,:)==1); 
% Total number of controllers, active and indices  
allcons=CLIDmods(17,:); 
totcon=sum(CLIDmods(17,:)); 
conact=find(CLIDmods(17,:)==1); 
 
if totmod==0 
   clerrdia(['ERROR: no active model available'],1) 
   return 
end 
% 
% Check if the chosen evaluation option has an opened window already: 
% 
if ~isempty(findobj('name',CLIDevas{option}))==1 
   fignum=findobj('name',CLIDevas{option}); 
   figure(fignum), hold on 
   modchange=CLIDmods(7,:)-get(fignum,'userdata'); 
   modact=find(modchange==1); 
   totmod=length(modact);    
   moderase=find(modchange==-1);  
   totmoderase=length(moderase); 
   set(fignum,'userdata',CLIDmods(7,:)); 
% 
else 
% Read active controller for all methods that require this information. 
  if option==1|option==2|option==3|option==4|option==5 
    if totcon==0 
     clerrdia(['ERROR: no active controller available'],1) 
     return 
    end 
  end 
 
% 
% Open the figures: 
%********************************************************************* 
% 
%                 Closed-loop transfer functions 
% 
%********************************************************************* 
  if option==1  
   % Make figure  
   posfgm=[(z(3)-z(1)+1)/2-375 (z(4)-z(2)+1)/2-45 400 315]; 
   fignum=figure('name',CLIDevas{option},... 
          'numbertitle','off','pos',posfgm,'color',c7,... 
          'menubar','none','DefaultAxesColor',edtcol,... 
          'DefaultAxesFontsize',10,'nextplot','add',... 
          'userdata',allmodels,'visible','off','TAG','CLTFFIG',... 
		  'DefaultAxesBox','on','DefaultAxesXcolor',axscol,... 
		  'DefaultAxesYcolor',axscol); 
   % Make toolbar and set callbacks  
   % File  
   cltffile=uimenu(fignum,'label','File'); 
%   cltffile1=uimenu(cltffile,'Label','Copy figure'); 
    cltffile20=uimenu(cltffile,'Label','Print...'); 
    set(cltffile20,'callback','print -v') 
    cltffile21=uimenu(cltffile,'Label','Printer setup...'); 
    set(cltffile21,'callback','print -dsetup') 
    cltffile3=uimenu(cltffile,'Label','Close','separator','on');     
    set(cltffile3,'callback',['close(',int2str(fignum),'),handle=findobj(''tag'',''CLTRANSVAL'');set(handle,''value'',0);clear handle']) 
   % Options 
   cltfopt=uimenu(fignum,'label','Options'); 
    % Auto range 
    cltfopt1=uimenu(cltfopt,'Label','Auto range'); 
    set(cltfopt1,'callback','clviewev(''option'',1)') 
    % Set axes limits  
    cltfopt2=uimenu(cltfopt,'Label','Set axes limits...'); 
    set(cltfopt2,'callback','clviewev(''option'',2)') 
    cltfopt3=uimenu(cltfopt,'Label','Frequency range...', 'Separator','on'); 
    set(cltfopt3,'callback','clviewev(''option'',3)') 
    % Style 
   cltfstyle=uimenu(fignum,'label','Style'); 
    % Grid 
    cltfstyle1=uimenu(cltfstyle,'Label','Grid'); 
    set(cltfstyle1,'callback','clviewev(''style'',1)') 
    % Zoom  
    cltfstyle2=uimenu(cltfstyle,'Label','Zoom','checked','on'); 
    set(cltfstyle2,'callback','clviewev(''style'',2)') 
    % Log amplitude scale 
    cltfstyle5=uimenu(cltfstyle,'Label','Log amplitude scale','checked','on', 'Separator','on'); 
    set(cltfstyle5,'callback','clviewev(''style'',5)') 
    % Linear amplitude scale  
    cltfstyle6=uimenu(cltfstyle,'Label','Linear amplitude scale'); 
    set(cltfstyle6,'callback','clviewev(''style'',6)') 
   % Channel 
    cltfchan=uimenu(fignum,'label','Channel'); 
    cltfchan1=uimenu(cltfchan,'Label','r1 -> u    (S)'); 
      set(cltfchan1,'callb','clviewev(''channel'',1)') 
    cltfchan2=uimenu(cltfchan,'Label','r1 -> y    (GS)'); 
      set(cltfchan2,'callb','clviewev(''channel'',2)') 
    cltfchan3=uimenu(cltfchan,'Label','r2 -> u    (CS)'); 
      set(cltfchan3,'callb','clviewev(''channel'',3)') 
    cltfchan4=uimenu(cltfchan,'Label','r2 -> y    (T)'); 
      set(cltfchan4,'callb','clviewev(''channel'',4)') 
    cltfchan5=uimenu(cltfchan,'Label','[r1 r2] -> [y u]'); 
      cltfchan51=uimenu(cltfchan5,'label','Amplitude','checked','on'); 
      set(cltfchan51,'callb','clviewev(''channel'',5)') 
      cltfchan52=uimenu(cltfchan5,'label','Phase'); 
      set(cltfchan52,'callb','clviewev(''channel'',6)') 
    cltfchan6=uimenu(cltfchan,'Label','e1 -> u','separator','on'); 
      set(cltfchan6,'callb','clviewev(''channel'',7)') 
    cltfchan7=uimenu(cltfchan,'Label','e1 -> y'); 
      set(cltfchan7,'callb','clviewev(''channel'',8)') 
    % Store handles from channel menu items in the user data of the menu 
    % item Channel 
    set(cltfchan,'userdata',[cltfchan1 cltfchan2 cltfchan3 cltfchan4 cltfchan51 cltfchan52 cltfchan6 cltfchan7]) 
   % Help 
      cltfhlp=uimenu(fignum,'label','Help'); 
	  cltfhlp1=uimenu(cltfhlp,'label','Help Topics'); 
	  set(cltfhlp1,'call','hthelp(''clindex.htm'')'); 
      
  % Correction 27-8-98: make the treatment for closed loop equal to open loop transfer functions     
    subplot(2,2,1),set(gca,'YScale','log','XScale','log'),title('T: r2 -> y'),hold on 
    subplot(2,2,2),,set(gca,'YScale','log','XScale','log'),title('GS: r1 -> y') ,hold on 
    subplot(2,2,3),set(gca,'YScale','log','XScale','log'),title('CS: r2 -> u') 
    xlabel('frequency (rad)'),ylabel('amplitude'),hold on 
    subplot(2,2,4),set(gca,'YScale','log','XScale','log'),title('S: r1 -> u') 
    xlabel('frequency (rad)'),hold on 
 
  % End correction    %%%%%%%%%%%%%%%%%%%%%%%% 
      
	  
   %Correction 24-8-98: account for sampling times other than 1.%  
   [dat,tit,info,p]=clobjget('datv'); 
   tsamp=p(2,1); 
   w=logspace(-3,pi,100)';N=length(w); % Default frequency axis 
   us(2:N+1,1)=w/tsamp; 
   %%%%%%%end correction&&&&&&&&&&&&&&&&&&&&&&& 
    
   % Define standard settings and store them in the userdata of the figure 
   us(1,1)=5;      % Default channel: amplitude of the transfer [r1 r2] -> [y u] 
   us(1,2)=1;      % Default logarithmic scale (=1); linear scale = 2. 
   us(2,2)=1;      % zoom is on (=1) by default. 
   us(3,2)=0;      % grid is off (=0) by default. 
    
   set(fignum,'userdata',us) 
 
   % Calculate and plot closed-loop transfer functions for all selected models 
   clplotev(1,'all')    
 
 
 
%********************************************************************* 
% 
%                 Closed-loop poles 
% 
%********************************************************************* 
  elseif option==2 
    posfgm=[(z(3)-z(1)+1)/2-380 (z(4)-z(2)+1)/2-128  300   273]; 
    fignum=figure('name',CLIDevas{option},'numbertitle','off',... 
         'pos',posfgm,'color',c7,... 
          'menubar','none','DefaultAxesColor',edtcol,... 
          'DefaultAxesFontsize',10,'nextplot','add',... 
          'userdata',allmodels,'visible','off','TAG','CLPOFIG',... 
    	  'DefaultAxesBox','on','DefaultAxesXcolor',axscol,... 
		  'DefaultAxesYcolor',axscol); 
 
%    plot([])  %removed 14-09-1998. 
    hold on    
   % Make toolbar and set callbacks  
   % File  
   clpofile=uimenu(fignum,'label','File'); 
%   clpofile1=uimenu(clpofile,'Label','Copy figure'); 
    clpofile20=uimenu(clpofile,'Label','Print...'); 
    set(clpofile20,'callback','print -v') 
    clpofile21=uimenu(clpofile,'Label','Printer setup...'); 
    set(clpofile21,'callback','print -dsetup') 
   clpofile3=uimenu(clpofile,'Label','Close','separator','on');     
    set(clpofile3,'callback',['close(',int2str(fignum),'),handle=findobj(''tag'',''CLPOLESVAL'');set(handle,''value'',0);clear handle']) 
   % Options 
   clpoopt=uimenu(fignum,'label','Options'); 
    % Auto range 
    clpoopt1=uimenu(clpoopt,'Label','Auto range'); 
    set(clpoopt1,'callback','clviewev(''option'',1)') 
    % Set axes limits  
    clpoopt2=uimenu(clpoopt,'Label','Set axes limits...'); 
    set(clpoopt2,'callback','clviewev(''option'',2)') 
   % Style 
   clpostyle=uimenu(fignum,'label','Style'); 
    % Grid 
    clpostyle1=uimenu(clpostyle,'Label','Grid'); 
    set(clpostyle1,'callback','clviewev(''style'',1)') 
    % Zoom  
    clpostyle2=uimenu(clpostyle,'Label','Zoom','checked','on'); 
    set(clpostyle2,'callback','clviewev(''style'',2)') 
    % Unit circle 
    clpostyle5=uimenu(clpostyle,'Label','Unit circle','checked','on', 'Separator','on'); 
    set(clpostyle5,'callback','clviewev(''style'',7)') 
    % Re/im axis  
%    clpostyle6=uimenu(clpostyle,'Label','Re/im axis'); 
%    set(clpostyle6,'callback','clviewev(''style'',8)') 
   % Channel 
   clpochan=uimenu(fignum,'label','Channel'); 
    clpochan1=uimenu(clpochan,'Label','r1 -> u    (S)'); 
    set(clpochan1,'callb','clviewev(''channel'',1)') 
    clpochan2=uimenu(clpochan,'Label','r1 -> y    (CS)'); 
    set(clpochan2,'callb','clviewev(''channel'',2)') 
    clpochan3=uimenu(clpochan,'Label','r2 -> u    (PS)'); 
    set(clpochan3,'callb','clviewev(''channel'',3)') 
    clpochan4=uimenu(clpochan,'Label','r2 -> y    (T)'); 
    set(clpochan4,'callb','clviewev(''channel'',4)') 
    clpochan5=uimenu(clpochan,'Label','[r1 r2] -> [y u]','checked','on'); 
    set(clpochan5,'callb','clviewev(''channel'',5)') 
    clpochan6=uimenu(clpochan,'Label','e1 -> u','separator','on'); 
    set(clpochan6,'callb','clviewev(''channel'',7)') 
    clpochan7=uimenu(clpochan,'Label','e1 -> y'); 
    set(clpochan7,'callb','clviewev(''channel'',8)') 
 
    % Store handles from channel menu items in the user data of the menu 
    % item Channel 
    set(clpochan,'userdata',[clpochan1 clpochan2 clpochan3 clpochan4 clpochan5 0 clpochan6 clpochan7]) 
   % Help  
    cltfhlp=uimenu(fignum,'label','Help'); 
    cltfhlp1=uimenu(cltfhlp,'label','Help Topics'); 
	set(cltfhlp1,'call','hthelp(''clindex.htm'')'); 
 
   % Set userdata of the figure right 
   us(1,1)=5;      % Default channel: [r2 r1] -> [y u] 
   set(fignum,'userdata',us) 
 
   % Default style of the figure 
%    axis('square'); om=linspace(0,2*pi); 
%    uncir=plot(cos(om),sin(om),'w');set(uncir,'TAG','UNITCIRCLE') 
%     
 
 %  Calculate closed-loop poles and draw the lines in the figures 
    clplotev(2,'all') 
 
%********************************************************************* 
% 
%              Input/output simulation 
% 
%********************************************************************* 
  elseif option==3 
    posfgm=[(z(3)-z(1)+1)/2-240 (z(4)-z(2)+1)/2-250  502   340]; 
    fignum=figure('name',CLIDevas{option},'numbertitle','off',... 
    'pos',posfgm,'color',c7,... 
    'menubar','none','DefaultAxesColor',edtcol,... 
    'DefaultAxesFontsize',10,'nextplot','add',... 
    'userdata',allmodels,'visible','off','TAG','CLIOFIG',... 
    'DefaultAxesBox','on','DefaultAxesXcolor',axscol,... 
	'DefaultAxesYcolor',axscol); 
	 
   % Make toolbar and set callbacks  
   % File  
   cliofile=uimenu(fignum,'label','File'); 
%   cliofile1=uimenu(cliofile,'Label','Copy figure'); 
    cliofile20=uimenu(cliofile,'Label','Print...'); 
    set(cliofile20,'callback','print -v') 
    cliofile21=uimenu(cliofile,'Label','Printer setup...'); 
    set(cliofile21,'callback','print -dsetup') 
   cliofile3=uimenu(cliofile,'Label','Close','separator','on');     
    set(cliofile3,'callback',['close(',int2str(fignum),'),handle=findobj(''tag'',''CLSIMVAL'');set(handle,''value'',0);clear handle']) 
   % Options 
   clioopt=uimenu(fignum,'label','Options'); 
    % Auto range 
    clioopt1=uimenu(clioopt,'Label','Auto range'); 
    set(clioopt1,'callback','clviewev(''option'',1)') 
    % Set axes limits  
    clioopt2=uimenu(clioopt,'Label','Set axes limits...'); 
    set(clioopt2,'callback','clviewev(''option'',2)') 
     % Signal plot versus error plot  
    clioopt3=uimenu(clioopt,'Label','Signal plot', 'Separator','on','checked','on'); 
     set(clioopt3,'callback','clviewev(''option'',7)') 
    clioopt4=uimenu(clioopt,'Label','Error plot'); 
     set(clioopt4,'callback','clviewev(''option'',8)') 
    % Style 
   cliostyle=uimenu(fignum,'label','Style'); 
    % Grid 
    cliostyle1=uimenu(cliostyle,'Label','Grid'); 
    set(cliostyle1,'callback','clviewev(''style'',1)') 
    % Zoom  
    cliostyle2=uimenu(cliostyle,'Label','Zoom','checked','on'); 
    set(cliostyle2,'callback','clviewev(''style'',2)') 
   % Channel 
   cliochan=uimenu(fignum,'label','Channel'); 
%    cliochan1=uimenu(cliochan,'Label','u'); 
%    cliochan2=uimenu(cliochan,'Label','y'); 
    cliochan3=uimenu(cliochan,'Label','u and y'); 
    cltfhlp=uimenu(fignum,'label','Help'); 
    cltfhlp1=uimenu(cltfhlp,'label','Help Topics'); 
	set(cltfhlp1,'call','hthelp(''clindex.htm'')'); 
 
% Calculate predictions and draw the lines in the figure 
  clplotev(3,'all')    
  
  
%********************************************************************* 
% 
%              Correlation test 
% 
%********************************************************************* 
  elseif option==4 
    posfgm=[(z(3)-z(1)+1)/2-360 (z(4)-z(2)+1)/2-352 367 320]; 
    fignum=figure('name',CLIDevas{option},'numbertitle','off',... 
    'pos',posfgm,'color',c7,... 
    'menubar','none','DefaultAxesColor',edtcol,... 
    'DefaultAxesFontsize',10,'nextplot','add',... 
    'userdata',allmodels,'visible','off','TAG','CLCORFIG',... 
		  'DefaultAxesBox','on','DefaultAxesXcolor',axscol,... 
		  'DefaultAxesYcolor',axscol); 
 
   % Make toolbar and set callbacks  
   % File  
   clcorfile=uimenu(fignum,'label','File'); 
%   clcorfile1=uimenu(clcorfile,'Label','Copy figure'); 
    clcorfile20=uimenu(clcorfile,'Label','Print...'); 
    set(clcorfile20,'callback','print -v') 
    clcorfile21=uimenu(clcorfile,'Label','Printer setup...'); 
    set(clcorfile21,'callback','print -dsetup') 
    clcorfile3=uimenu(clcorfile,'Label','Close','separator','on');     
    set(clcorfile3,'callback',['close(',int2str(fignum),'),handle=findobj(''tag'',''CLRESIDVAL'');set(handle,''value'',0);clear handle']) 
   % Optcorns 
   clcoropt=uimenu(fignum,'label','Options'); 
    % Auto range 
    clcoropt1=uimenu(clcoropt,'Label','Auto range'); 
    set(clcoropt1,'callback','clviewev(''option'',1)') 
    % Set axes limits  
    clcoropt2=uimenu(clcoropt,'Label','Set axes limits...'); 
    set(clcoropt2,'callback','clviewev(''option'',2)') 
     % Number of lags 
    clcoropt3=uimenu(clcoropt,'Label','Number of lags...', 'Separator','on'); 
     set(clcoropt3,'callback','clviewev(''option'',6)') 
   % Style 
   clcorstyle=uimenu(fignum,'label','Style'); 
    % Grid 
    clcorstyle1=uimenu(clcorstyle,'Label','Grid'); 
    set(clcorstyle1,'callback','clviewev(''style'',1)') 
    % Zoom  
    clcorstyle2=uimenu(clcorstyle,'Label','Zoom','checked','on'); 
    set(clcorstyle2,'callback','clviewev(''style'',2)') 
   % Channel 
   clcorchan=uimenu(fignum,'label','Channel'); 
%    clcorchan1=uimenu(clcorchan,'Label','u'); 
%    clcorchan2=uimenu(clcorchan,'Label','y'); 
     clcorchan3=uimenu(clcorchan,'Label','u and y'); 
      cltfhlp=uimenu(fignum,'label','Help'); 
	  cltfhlp1=uimenu(cltfhlp,'label','Help Topics'); 
	  set(cltfhlp1,'call','hthelp(''clindex.htm'')'); 
 
 
   % Define standard settings and store them in the userdata of the figure 
   N=50;        % Default length of step responses 
   us(2,1)=N; 
   us(1,1)=0;      % Of none importance for this evaluation method 
   set(fignum,'userdata',us) 
 
% Calculate correlation tests and draw the lines 
  clplotev(4,'all') 
 
 
%********************************************************************* 
% 
%            Closed-loop step response 
% 
%********************************************************************* 
 
  elseif option==5 
    posfgm=[(z(3)-z(1)+1)/2-350 (z(4)-z(2)+1)/2-322 461 350]; 
    fignum=figure('name',CLIDevas{option},'numbertitle','off',... 
     'pos',posfgm,'color',c7,... 
     'menubar','none','DefaultAxesColor',edtcol,... 
     'DefaultAxesFontsize',10,'nextplot','add',... 
     'userdata',allmodels,'visible','off','TAG','CLSTFIG',... 
	  'DefaultAxesBox','on','DefaultAxesXcolor',axscol,... 
	  'DefaultAxesYcolor',axscol); 
 
 
   % Make toolbar and set callbacks  
   % File  
   cltffile=uimenu(fignum,'label','File'); 
%   cltffile1=uimenu(cltffile,'Label','Copy figure'); 
    cltffile20=uimenu(cltffile,'Label','Print...'); 
    set(cltffile20,'callback','print -v') 
    cltffile21=uimenu(cltffile,'Label','Printer setup...'); 
    set(cltffile21,'callback','print -dsetup') 
    cltffile3=uimenu(cltffile,'Label','Close','separator','on');     
    set(cltffile3,'callback',['close(',int2str(fignum),'),handle=findobj(''tag'',''CLSTEPVAL'');set(handle,''value'',0);clear handle']) 
   % Options 
   cltfopt=uimenu(fignum,'label','Options'); 
    % Auto range 
    cltfopt1=uimenu(cltfopt,'Label','Auto range'); 
    set(cltfopt1,'callback','clviewev(''option'',1)') 
    % Set axes limits  
    cltfopt2=uimenu(cltfopt,'Label','Set axes limits...'); 
    set(cltfopt2,'callback','clviewev(''option'',2)') 
     % Step response and impulse response 
    cltfopt3=uimenu(cltfopt,'Label','Step response','checked','on','Separator','on'); 
     set(cltfopt3,'callback','clviewev(''option'',4)') 
    cltfopt4=uimenu(cltfopt,'Label','Impulse response'); 
     set(cltfopt4,'callback','clviewev(''option'',5)') 
    % Number of lags 
    cltfopt3=uimenu(cltfopt,'Label','Number of lags...', 'Separator','on'); 
     set(cltfopt3,'callback','clviewev(''option'',6)') 
   % Style 
   cltfstyle=uimenu(fignum,'label','Style'); 
    % Grid 
    cltfstyle1=uimenu(cltfstyle,'Label','Grid'); 
    set(cltfstyle1,'callback','clviewev(''style'',1)') 
    % Zoom  
    cltfstyle2=uimenu(cltfstyle,'Label','Zoom','checked','on'); 
    set(cltfstyle2,'callback','clviewev(''style'',2)') 
   % Channel 
   cltfchan=uimenu(fignum,'label','Channel'); 
%    cltfchan0=uimenu(cltfchan,'Label','u -> y'); 
    cltfchan1=uimenu(cltfchan,'Label','r1 -> u    (S)'); 
      set(cltfchan1,'callb','clviewev(''channel'',1)') 
    cltfchan2=uimenu(cltfchan,'Label','r2 -> u    (CS)'); 
      set(cltfchan2,'callb','clviewev(''channel'',2)') 
    cltfchan3=uimenu(cltfchan,'Label','r1 -> y    (PS)'); 
      set(cltfchan3,'callb','clviewev(''channel'',3)') 
    cltfchan4=uimenu(cltfchan,'Label','r2 -> y    (T)'); 
      set(cltfchan4,'callb','clviewev(''channel'',4)') 
    cltfchan5=uimenu(cltfchan,'Label','[r1 r2] -> [y u]','checked','on'); 
      set(cltfchan5,'callb','clviewev(''channel'',5)') 
      cltfhlp=uimenu(fignum,'label','Help'); 
	  cltfhlp1=uimenu(cltfhlp,'label','Help Topics'); 
	  set(cltfhlp1,'call','hthelp(''clindex.htm'')'); 
 
 
    % Store handles from channel menu items in the user data of the menu 
    % item Channel 
    set(cltfchan,'userdata',[cltfchan1 cltfchan2 cltfchan3 cltfchan4 cltfchan5]) 
 
   % Define standard settings and store them in the userdata of the figure 
   N=100;        % Default length of step responses 
   us(2,1)=N; 
   us(1,1)=5;      % Default channel: amplitude of the transfer [r1 r2] -> [y u] 
   set(fignum,'userdata',us) 
   
% Calculate step responses and draw the lines 
    clplotev(5,'all') 
 
 
%********************************************************************* 
% 
%            Plant transfer function 
% 
%********************************************************************* 
 
  elseif option==6 
    posfgm=[(z(3)-z(1)+1)/2-370 (z(4)-z(2)+1)/2-350 452 330]; 
    fignum=figure('name',CLIDevas{option},'numbertitle','off',... 
     'pos',posfgm,'color',c7,... 
     'menubar','none','DefaultAxesColor',edtcol,... 
     'DefaultAxesFontsize',10,'nextplot','add',... 
     'userdata',allmodels,'visible','off','TAG','OLTFFIG',... 
     'DefaultAxesBox','on','DefaultAxesXcolor',axscol,... 
	 'DefaultAxesYcolor',axscol); 
 
 
   % Make toolbar and set callbacks 
   % File  
   oltffile=uimenu(fignum,'label','File'); 
%   oltffile1=uimenu(oltffile,'Label','Copy figure'); 
    oltffile20=uimenu(oltffile,'Label','Print...'); 
    set(oltffile20,'callback','print -v') 
    oltffile21=uimenu(oltffile,'Label','Printer setup...'); 
    set(oltffile21,'callback','print -dsetup') 
    oltffile3=uimenu(oltffile,'Label','Close','separator','on');     
    set(oltffile3,'callback',['close(',int2str(fignum),'),handle=findobj(''tag'',''CLOLTRVAL'');set(handle,''value'',0);clear handle']) 
   % Options 
   oltfopt=uimenu(fignum,'label','Options'); 
    oltfopt1=uimenu(oltfopt,'Label','Auto range'); 
    set(oltfopt1,'callback','clviewev(''option'',1)') 
    oltfopt2=uimenu(oltfopt,'Label','Set axes limits...'); 
    set(oltfopt2,'callback','clviewev(''option'',2)') 
     oltfopt3=uimenu(oltfopt,'Label','Frequency range...', 'Separator','on'); 
     set(oltfopt3,'callback','clviewev(''option'',3)') 
   % Style 
   oltfstyle=uimenu(fignum,'label','Style'); 
    oltfstyle1=uimenu(oltfstyle,'Label','Grid','callback','clviewev(''style'',1)');    
    oltfstyle2=uimenu(oltfstyle,'Label','Zoom','checked','on','callback','clviewev(''style'',2)'); 
%   oltfstyle3=uimenu(oltfstyle,'Label','Frequency (rad/sec)','checked','on', 'Separator','on'); 
%   oltfstyle4=uimenu(oltfstyle,'Label','Frequency (Hz)'); 
    oltfstyle5=uimenu(oltfstyle,'Label','Log amplitude scale','checked','on', 'Separator','on','callback','clviewev(''style'',5)'); 
    oltfstyle6=uimenu(oltfstyle,'Label','Linear amplitude scale','callback','clviewev(''style'',6)'); 
%    oltfstyle7=uimenu(oltfstyle,'Label','Separate linetypes', 'Separator','on'); 
%    oltfstyle8=uimenu(oltfstyle,'Label','All solid lines'); 
   % Channel 
   oltfchan=uimenu(fignum,'label','Channel'); 
    oltfchan1=uimenu(oltfchan,'Label','u -> y','checked','on'); 
    set(oltfchan1,'callb','clviewev(''channel'',1)') 
    oltfchan2=uimenu(oltfchan,'Label','e1 -> y','separator','on'); 
    set(oltfchan2,'callb','clviewev(''channel'',2)') 
    % Store handles from channel menu items in the user data of the menu 
    % item Channel 
    set(oltfchan,'userdata',[oltfchan1 oltfchan2]) 
    % Help 
      cltfhlp=uimenu(fignum,'label','Help'); 
	  cltfhlp1=uimenu(cltfhlp,'label','Help Topics'); 
	  set(cltfhlp1,'call','hthelp(''clindex.htm'')'); 
 
  % Make default axis 
    subplot(211),set(gca,'YScale','log','XScale','log') 
    title('Open-loop frequency response G: u -> y') 
    xlabel('frequency (rad)'),ylabel('amplitude'),hold on 
    subplot(212),set(gca,'YScale','linear','XScale','log')  
    xlabel('frequency (rad)'),ylabel('phase'), hold on 
 
  % Define standard settings and store them in the userdata of the figure 
  %Correction 24-8-98: account for sampling times other than 1. 
   [dat,tit,info,p]=clobjget('datv'); 
   tsamp=p(2,1); 
   w=logspace(-3,pi,100)';N=length(w); % Default frequency axis 
   us(1,1)=1;us(2:N+1,1)=w/tsamp; 
  %%%%%%end correction&&&&&&&&&&&&&&&&&&&&  
   set(fignum,'userdata',us) 
 
 
  % Calculate plant transfer and draw the lines 
    clplotev(6,'all') 
 
 
%********************************************************************* 
% 
%            Plant pole-zeros 
% 
%********************************************************************* 
  elseif option==7 
    posfgm=[(z(3)-z(1)+1)/2-330 (z(4)-z(2)+1)/2-230 286   273]; 
    fignum=figure('name',CLIDevas{option},'numbertitle','off',... 
         'pos',posfgm,'color',c7,... 
          'menubar','none','DefaultAxesColor',edtcol,... 
          'DefaultAxesFontsize',10,'nextplot','add',... 
          'userdata',allmodels,'visible','off','TAG','OLPOFIG',... 
		  'DefaultAxesBox','on','DefaultAxesXcolor',axscol,... 
		  'DefaultAxesYcolor',axscol); 
 
 
   % Make toolbar and set callbacks  
   % File  
   olpofile=uimenu(fignum,'label','File'); 
%   olpofile1=uimenu(olpofile,'Label','Copy figure'); 
    olpofile20=uimenu(olpofile,'Label','Print...'); 
    set(olpofile20,'callback','print -v') 
    olpofile21=uimenu(olpofile,'Label','Printer setup...'); 
    set(olpofile21,'callback','print -dsetup') 
    olpofile3=uimenu(olpofile,'Label','Close','separator','on');     
    set(olpofile3,'callback',['close(',int2str(fignum),'),handle=findobj(''tag'',''CLOLPZVAL'');set(handle,''value'',0);clear handle']) 
   % Options 
   olpoopt=uimenu(fignum,'label','Options'); 
    % Auto range 
    olpoopt1=uimenu(olpoopt,'Label','Auto range'); 
    set(olpoopt1,'callback','clviewev(''option'',1)') 
    % Set axes limits  
    olpoopt2=uimenu(olpoopt,'Label','Set axes limits...'); 
    set(olpoopt2,'callback','clviewev(''option'',2)') 
    % Style 
   olpostyle=uimenu(fignum,'label','Style'); 
    % Grid 
    olpostyle1=uimenu(olpostyle,'Label','Grid'); 
    set(olpostyle1,'callback','clviewev(''style'',1)') 
    % Zoom  
    olpostyle2=uimenu(olpostyle,'Label','Zoom','checked','on'); 
    set(olpostyle2,'callback','clviewev(''style'',2)') 
    % Unit circle 
    olpostyle5=uimenu(olpostyle,'Label','Unit circle','checked','on', 'Separator','on'); 
    set(olpostyle5,'callback','clviewev(''style'',7)') 
    % Re/im axis  
%    olpostyle6=uimenu(olpostyle,'Label','Re/im axis'); 
%    set(olpostyle6,'callback','clviewev(''style'',8)') 
   % Channel 
   olpochan=uimenu(fignum,'label','Channel'); 
    olpochan1=uimenu(olpochan,'Label','u -> y','checked','on'); 
    set(olpochan1,'callb','clviewev(''channel'',1)') 
    olpochan2=uimenu(olpochan,'Label','e1 -> y','separator','on'); 
    set(olpochan2,'callb','clviewev(''channel'',2)') 
    % Store handles from channel menu items in the user data of the menu 
    % item Channel 
    set(olpochan,'userdata',[olpochan1 olpochan2]) 
   % Help 
      cltfhlp=uimenu(fignum,'label','Help'); 
	  cltfhlp1=uimenu(cltfhlp,'label','Help Topics'); 
	  set(cltfhlp1,'call','hthelp(''clindex.htm'')'); 
 
 
    axis('square');hold on 
%    om=linspace(0,2*pi); 
%    uncir=plot(cos(om),sin(om),'w');set(uncir,'TAG','UNITCIRCLE') 
     
 
  % Define standard settings and store them in the userdata of the figure 
   us(1,1)=1; 
   set(fignum,'userdata',us) 
    
  % Calculate open-loop poles and draw the lines 
   clplotev(7,'all') 
 end 
end