www.gusucode.com > 图形修饰界面 > clab_help.m

    %clab_help is the function to display the help information in CrtlLAB and Matx_Proc.
%
%   clab_help(nTask)
%where
%  nTask -- is the Help information code
%
%The functions available in the module are
%
%   help_window --- displays help information
%   shw_about display the About dialog box in CtrlLAB.
%

%Copyright (c) 1997-1999 by Professor Dingyu Xue
%School of Information Science and Engineering, Northeastern University
%Shenyang 110006, P R China
%Email: xue_dy@hotmail.com
%--------------------------------------------------------------------------

function clab_help(nTask)
bHelp=1;

%According to the Help code, select approperiate help information to display.  
%For details of the Help code, please check the hlp_Title in each case.
switch nTask
case -1, 
   hlp_Title='Quick Start with CtrlLAB';
   hlp_Contents=str2mat(...
      'To start with CtrlLAB, one should enter the system models by clicking the',...
      'blocks on the dialog box in the main window.  The user are allowed to enter',...
      'the models in different ways as in the dialog box.',' ',...
      'If the plant model has been entered, the one can select the {\itModel} menu',...
      'to modify, display and processing the models.',' ',...
      'One can also select the {\itAnalysis} menu to perform system analysis tasks to',...
      'the models entered.',' ',...
      'One may select the {\itDesign} menu to design controller to the system using',...
      'different design tools.',' ',...
      '{\bfColor Conventions on Graphs}',...
      'In system analysis, if two curves are plotted, then the original model is',...
      'represented by green color, while the compensated in blue color.',' ',' ',' ',...
      'Good luck and enjoy using CtrlLAB.');
case 0, 
   hlp_Title='Introduction to CtrlLAB';
   hlp_Contents=str2mat(...
      'CtrlLAB^\copyright is a series of MATLAB functions which provides graphical',...
      'interface to perform feedback system analysis and design tasks.',' ',...
      'The facilities provided by CtrlLAB are:',...
      '   a) model entering, including SIMULINK modeling',...
      '   b) model display',...
      '   c) system state space realisation',...
      '   d) model reduction using different algorithms',...
      '   e) system analysis in frequency, complex and time domain',...
      '   f) graphical display and figure editing and manipulation',...
      '   g) a matrix displayer and editor',...
      '   h) PID tuning and displaying facilities',...
      '   i) a great many controller design procedures are implemented',' ',...
      '{\bfCopyright declearations}',...
      '    {\bf CtrlLAB can be distributed freely in this unmodified package for }',...
      '    {\bf noncommercial use.}',' ',...
      'Please refer to Readme.txt file for more detailed information of CtrlLAB.',...
      'Theoratical details can be found in ',...
      '{\bfDingyu Xue} and {\bfDerek Atherton}, {\itFeedback Control Systems Analysis }',...
      '{\itand Design using MATLAB}. (Internal Lecture Notes, with the PostScript',...
      'version of the Contents attached in the package)');
case 1, 
   hlp_Title='Transfer Function Input';
   hlp_Contents=str2mat(...
      'In CtrlLAB, transfer functions can be entered by numerator and denominator',...
      'polynomials in one of the two ways:',' ',...
      '1) {\bf The MATLAB arrays:}',...
      '   a). A transfer function in the form of s^3+4s^2+3s+1 can be entered',...
      '       as [1,4,3,1];',...
      '   b). complicated polynomials can be entered in MATLAB expressions, ',...
      '       e.g., the polynomial (s^2+3s+3)^2(s+1)^2 can be entered as',...
      '       conv(conv(conv([1,3,3],[1,3,3]),[1,1]),[1,1])','  ',...
      '       The transfer function can be entered in a more concise way, the',...
      '       use of m\_conv() function in the book.  The transfer function in',...
      '       the previous example can be entered as',' ',...
      '       m\_conv([1,3,3],[1,3,3],[1,1],[1,1])','  ',...
      '2) {\bf The natural way:}',...
      '   The polynomial can be entered as ''s'' polynomial strings with the',...
      '   \^ and * signs omitted.  It is more flexible.  E.g., the polynomial',...
      '   in case a) above can be entered as s3+4s2+3s+1, with the integer',...
      '   follows the s-operator indicates the power.  And in case b)., the',...
      '   polynomial can be entered as (s2+3s+3)2(s+1)2.',...
      '   It should be noted that in this case, one should not use the \^ and ',...
      '   * signs.  Otherwise there will be error message.');
case 2,
   hlp_Title='Demonstration Description';
   hlp_Contents=str2mat(...
      '{\bfDemo Problem: }plant G(s)=1/(s+1)^3, Draw Bode, and Nichols plots, and',...
      '    design PID controller, also evaluate the closed-loop system step response',' ',...
      '{\it Step 1}: model entering',...
      '     1). Press G(s) button',...
      '     2). fill in transfer functions, i.e. 1 and (s+1)3, respectively in the dialog',...
      '       box provided',...
      '     3). the display is made automatically',' ',...
      'Other model formats are also acceptable to CtrlLAB, including ',...
      'SIMULINK model!',' ',...);
      '{\it Step 2}: Bode diagram',...
      '   1). Select Analysis/Bode diagram menu item',...
      '   2). the Bode diagram of the plant is displayed in a new window.',' ',...
      '{\it Step 3}: Nichols chart',...
      '   1). Select Analysis/Nichols chart menu item',...
      '   2). the Nichols chart of the plant is displayed in a new window.',' ',...
      '{\it Step 4}: PID controller design',...
      '   1). Select Design/PID controllers/One-shot design/Ziegler-Nichols',...
      '   2). the PID controller can be displayed in a new window.',...
      '   3). The step response of the closed-loop system can be drawn');
case 3, 
   hlp_Title='What''s New in CtrlLAB 3.0';
   hlp_Contents=str2mat('CtrlLAB 3.0 is rewritten in MATLAB 5.1 and the GUI is implemented',...
      'in MATLAB functions rather than the MATLAB scripts in the earlier',...
      'versions.  This made the system more reliable than before.',' ',...
      'CtrlLAB 3.0 is no longer available in MATLAB 4.2 due to the incompatible ',...
      'data structure.',' ',...
      'The following are the new facilities in CtrlLAB 3.0:',' ',...
      '   1) MATLAB workspace is clean now, since all the intermidiate variables',...
      '      are passed by GUI itself, rather than by variables in workspace.',...
      '   2) Robustness of the program is increased, where the new facilities in',...
      '      MATLAB 5 and over are extensively used.',...
      '   3) GUI is slightly changed from CtrlLAB 2.0 where more powerful graphs',...
      '      processing, system display, analysis and design can be more easily',...
      '      accessed by the users.',...
      '   4) SIMULINK modelling part is rewritten such that new block facilities,',...
      '      such as saturation actuator, ZOH, measurement noise can be included ',...
      '      in the system.',...
      '   5) Program structure is more versitile now and it can easily be further',...
      '      extended to incoorperate with new facilities.');
case 4,
   hlp_Title='About Model Reduction';
   hlp_Contents=str2mat(...
      'Several model reduction algorithms to SISO continuous models are',...
      'implemented in CtrlLAB.  The currently available ones are included',...
      'in the {\itselect a method} list box. ',' ',...   
      'Once a method is selected, one should fill in also the expected order',...
      'for reduction.  Sometimes both the orders of numerator and denominator',...
      'should be entered.  One can also specify whether a delay term is ',...
      'expected in the reduced model.','  ',...
      'When the {\itoptimal reduction} method is selected, the user should also',...
      'enter the input type and the weightings for the optimisation criterion.',' ',...   
      'The optimisation criterion is defined as',...
      '    J=\int_0^\infty f^2(t) e^2(t) dt',...
      'where f(t)=1 for ISE, f(t)=t for ITSE, f(t)=e^{-c_4t} for exponential',' ',...   
      'The input type is defined as',...
      '      u(t)=c_1 + c_2 e^{-c_3 t}',...
      'and one should enter the C vector to specofy the values of c_1,c_2,c_3,c_4. The',...
      'variable c_5 is a reserved variable that is not currently used.');
case 5,
   hlp_Title='About File Menu';
   hlp_Contents=str2mat(...
      '{\bfFile} menu in the CtrlLAB main window is provided to allow the user to ',...
      'save and load internal models to and from files.  The menu is useful in the ',...
      'workspace management for CtrlLAB.  The submenus are summarised below:',' ',...
      '  {\bf\itNew} menu item: to allow the user to clear unwanted wariables in the ',...
      '         workspace and start with a new model.',' ',...
      '  {\it\bfOpen} menu item: to allow the user to load a previousl saved data file ',...
      '         to restore models.',' ',...
      '  {\itSave} and {\itSave As} menu items: This two menu items allows the user to ',...
      '         save the system models under study to data files.  Like other windows ',...
      '         applications, the Save as menu saves the models to a new data file.',...
      '  {\bf\itExit} menu item: will allow the user to quit CtrlLAB, and close other ',...
      '         related windows.  Also the model unsaved will be saved.');
case 6,
   hlp_Title='About Model Menu';
   hlp_Contents=str2mat(...
      '{\bfModel} menu in the CtrlLAB main window is provided to allow the user to ',...
      'select different input and display types for the system models.  Also ',...
      'reductions to the existing plant model is allowed.',' ',...
      '  {\bfModel Select} menu item: to allow the user to select different part of the',...
      '         feedback system structure, such as the plant model, the controller ',...
      '         model, the feedback model, and possibly the delay model.',' ',...
      '  {\itModel Type} menu item: to allow the user to select a type for model input.',...
      '         Linear models can be entered by trafsfer function, state space or pole-',...
      '         zero-gain models.  Linear or nonlinear model can be entered using ',...
      '         the SIMULINK program.',' ',...
      '  {\itDisplay Type} menu items: This menu item allows the user to select a model',...
      '         type for display.  The transfer function, state space model, pole-zero-',...
      '         gain model and the factorised transfer function models are allowed. ',' ',...
      '  {\itRealisation} menu item: allows the user to get the state space model by',...
      '         different known realisations, such as the controllable canonical, etc.','  ',...
      '  {\bfReduction} menu item: The model reduction to the plant model can be ',...
      '         obtained by using this menu.  A dialog box will be given.',' ',...
      '  Other menu items: The model can be displayed/editted by {\bfShow} and',...
      '         {\bfModify} menu items.  The model library in SIMULINK can be',...
      '         displayed using the {\bfShow Model Library} menu item.');
case 7,
   hlp_Title='System Analysis Facilities';
   hlp_Contents=str2mat(...
      '{\bfAnalysis} menu in the CtrlLAB main window is provided to allow the user ',...
      'to perform different analysis tasks for the model given.  The Bode diagram, ',...
      'Nyquist plot, Nichols chart, inverse Nyquist plot, step/impulse responses, ',...
      'root locus for the system with different combinations (such as open-loop and ',...
      'closed-loop, compensated and uncompensated etc) using the relavent menu ',...
      'items, and the curves will be displayed in relavent windows.','  ',...
      'The stability marginss, analytcal solutions, and gain phase margins of the ',...
      'given system model can also be obtained and displayed in the Information ',...
      'Display Window by using different menu items.',' ',...
      'The state space representation of the plant model can be displayed in the ',...
      'Matrix Processor Window when the {\itCall Matrix Processor} menu item is ',...
      'selected, where the system can be analysed in the relevent GUI.',' ',...
      'The {\itLoop Specs and Signals} menu is useful for the user to specify which of ',...
      'the system model is to be analyzed.  One may select different specifications ',...
      'from it.  It is worth mentioning that the signal selections are mainly for time',...
      'response analysis, while the transfer function specifications are mainly for ',...
      'frequency domain and complex domain.');
case 8,
   hlp_Title='System Design Facilities';
   hlp_Contents=str2mat(...
      '{\bfDesign} menu in the CtrlLAB main window is provided to allow the user ',...
      'to design compensators for the given plant model, using different design',...
      'techniques.  Currently three classes of design techniques are available.',' ',...
      '{\bfClassical Compensation} menu item: Allows the design using the lead-',...
      '      lag, LQR, pole placement, and model following methods',' ',...
      '{\bfPID Control} menu item: Allows to design a PID controller using ',...
      '      different algorithms and different structures.  ',...
      '{\bfRobust Control} menu item: Allows one to design a robust controller,',...
      '      such as the LQG, LQG/LTR, H_2, H_\infty and the optimal H_\infty controller.',' ',...
      'More information on each of the controller can be obtained in the Help',...
      'information in the relevent design dialog boxes.');
case 9,
   hlp_Title='About Graphics Window';
   hlp_Contents=str2mat(...
      'Graphics Window in CtrlLAB provides easy to use graphics processing ',...
      'facilities which include zooming, legend adding, curve editting and other ',...
      'useful functions.  These functions can be called from the {\bfOptions} menu ',...
      'items.',' ',...
      '  {\bfAxis} and {\bfGrid} menu item: toggle on/off grid and axis.  Also the curves',...
      '      can be held to allow more to be drawn in the same axis.',' ',...
      '  {\bfCursor} menu item: to use mouse to locate points on the curves.',' ',...
      '  {\bfLegends} menu item: to allow user to add, edit legends/arrows/lines to the',...
      '      curves.  Legends can be manipulated also using this menu item.',' ',...
      '  {\bfZoom} menu item: to allow user to zoom the curves.  By selecting the',...
      '      menu item, one can drag on the curve for zooming.',' ',...
      '  {\bfEdit Plot} menu item: allow the user to modify existing curves.  One can',...
      '      delete and modify colors/lne styles of the existing curves.',' ',...
      '  {\bfSave as EPS File} menu item: allow the user to save current figure to an',...
      '      EPS (Encaptulated PostScript) file.',' ',...
      '  {\bfPlot Preference} menu item: Allow user to specify more graphics properties',...
      '      and model combinations.  More details can be obtained from the {\itHelp} ',...
      '      information of its dialog box.');
case 10,
   hlp_Title='Lead/lag Cascade Compensation';
   hlp_Contents=str2mat(...
      'The general form of the controller is',' ',...
      '      G_c(s)=K_c(s+z_{c1})(s+z_{c2})/[(s+p_{c1})(s+p_{c2})], ',' ',...
      'with z_{c1}\leq p_{c1}, and z_{c2}\geq p_{c2}.  Also z_{c2}=p_{c2} for lead compensation and ',...
      'z_{c1}= p_{c1} for lag compensation.',' ',...
      'One can select the {\itCompensator Type} listbox to determine the compensator ',...
      'format.  If {\it Auto} is selected, then it will be determined automatically.',' ',...
      'One has to specify the crossover frequency \omega_c, the phase margin \gamma and the',...
      'the steady-state error tolerance K_v to design a compensator.  When these ',...
      'parameters are specified, one can just press {\itDesign} button to design the ',...
      'controller.  Or the {\it Cancel} button allows one to terminate the design ',...
      'process.  Some times one can press {\itMaximise} \omega_c button to design a ',...
      'controller for the given \gamma.',' ',...
      'Please note that the controller thus designed may not satisfactorily meet the',...
      'original \omega_c and \gamma specifications.  It is adviced to check the design results ',...
      'before it is used.');
case 11,
   hlp_Title='LQ Optimal Controller Design';
   hlp_Contents=str2mat(...
      'To design a controller which minimises the LQ (linear quadratic) criterion',' ',...
      '       J = \int_0^\infty[x^T(t) Q(t)x(t)+u^T(t) R(t)u(t) dt',' ',...
      'where x(t) is the state variable, Q \leq 0 and R>1 are weighting matrices.  One ',...
      'can select R=1 in CtrlLAB.  The control signal can be written as u(t)=-K x(t), ',...
      'with K a constant matrix satisfying the algebraic equation',' ',...
      '      -P A - A^T P  + P B R^{-1} B^T P - Q = 0',' ',...
      'and (A,B) are the state space equation of the plant model.  ',' ',...
      'Two types of controller are allowed in CtrlLAB: ',...
      '   1) state feedback control',...
      '   2) observer-based feedback control',' ',...
      'In the dialog box, one should enter the weighting matrix Q in MATLAB ',...
      'matrix form.  Also, select a control type.  If observer-based method is ',...
      'selected, then, the expected pole positions of the observer can be used',...
      'in a vector form.');
case 12,
   hlp_Title='Pole-Placement Controller Design';
   hlp_Contents=str2mat(...
      'Suppose that the eigen polynomials of the plant and expected closed loop ',...
      'model can be written as ',' ',...
      '   a(s)=det(sI-A)=s^n+\Sigma_{i=0}^{n-1}a_is^i,   \alpha(s)=\Pi_{i=1}^n (s-\mu_i)=s^n+\Sigma_{i=0}^{n-1} \alpha_i s^i',' ',...
      'The control signal can be written as u(t)=-K x(t), with K a constant vector',' ',...
      '   K = (\alpha-a)^T L^{-1} C^{-1}',' ',...
      'where (a-\alpha)^T=[(a_0-\alpha_0),\cdots, (a_{n-1}-\alpha_{n-1})], C=[b, Ab, \cdots, A^{n-1}b], and L is ',...
      'a Hankel matrix composed with coefficients of a(s).',' ',...
      'Two types of controller are allowed in CtrlLAB: ',...
      '   1) state feedback control',...
      '   2) observer-based feedback control',' ',...
      'In the dialog box, one should enter the expected pole positions in MATLAB',...
      'vector form.  Also, select a control type.  If observer-based method is ',...
      'selected, then, the expected pole positions of the observer can be used',...
      'in a vector form.');
case 13,
   hlp_Title='PID Controller Design';
   hlp_Contents=str2mat(...
      'PID (Proportional-Integral-Derivative) controller is very useful in',...
      'process control.  The general form of the controller is ',' ',...
      '   G_c(s)=K_p [1+T_d s + 1/(T_i s)]',' ',...
      'and the variation of it can be written as',' ',...
      '   G_c(s)=K_p (1+T_d s) ',' ',...
      'and the derivative action is performed in the feedback path.  The variables ',...
      'T_i, T_d can also be omitted to compose the P, PI controller as well.  ',...
      'Type type of the controller can be set in the {\bfController type} menu item.',' ',...
      'To design the PID controller, the plant model is often fitted into a first ',' ',...
      'order model with delay G_m(s)=k e^{-\tau s}/(T s+1), using different methods which',...
      'can be set in {\bfFirst-order identification Method} menu item.',' ',...
      'Various of algorithms are available in CtrlLAB and {\bfOne-shot} menu designs',...
      'PID controller with no extra specifications.  Details of other methods can be ',...
      'found in the Help facility in different methods.');
case 14,
   hlp_Title='PID Controller Design with Specifications';
   hlp_Contents=str2mat(...
      'Three PID algorithms are provided in the group:',' ',...
      '  {\bfChien (CHR) tuning}: Implement the Chien-Hrones-Reswick algorithm.  ',...
      '      Two overshoots are allowed such that 0% and 20% overshoots.  Selecting ',...
      '      an overshoot and the click {\bfDesign} button, the controller can be',...
      '      designed.',...
      '  {\bfModified Ziegler-Nichols tuning}: The two parameters, r_b and \phi_b, are ',...
      '      expected from the user, which means that to design a controller to move',...
      '      the original negative real axis crossing point to the one with gain of r_b ',...
      '      and phase angle of \phi_b.',...
      '  {\bfInternal model control}: A filter constant T_f is expected from the user',...
      '      to design a PID controller.',' ',...
      '{\itReferences}:',...
      '   [1] Astrom K J, PID controllers: theory, design and tuning, Research ',...
      '      Triangle Park, Instrument Society of America, 1995',...
      '   [2] D Xue and D P Atherton, Feedback Control Systems (Lecture Notes)');
case 15,
   hlp_Title='Optimal PID Controller Design';
   hlp_Contents=str2mat(...
      'Optimum PID controller design techniques are allowed in CtrlLAB through',...
      'the {\bfOptimum tuning} and {\bfGain phase tuning} menu items.  These design ',...
      'are based on the first-order plus delay approximation to the plant model, ',...
      'and the methods available can be selected from the {\bfFirst-order }',...
      '{\bfIdentification Method} menu.',' ',...
      '   For {\bfOptimum tuning} menu, three optimum criteria are available:',' ',...
      '      (1) ISE, which is \int_0^\infty e^2(t)dt',...
      '      (2) ISTE, which is \int_0^\infty t^2 e^2(t)dt',...
      '      (3) IST2E, which is \int_0^\infty t^4 e^2(t)dt',' ',...
      'where e(t) is the error signal enters the controller.',' ',...
      '   For {\bfGain phase tuning} menu, optimum PID controller can be designed',...
      'based on the gain/phase margin of the plant model.  ',' ',...
      '{\itReferences}:',...
      '  [1] Zhuang  M,  Atherton D P. Automatic tuning of optimum PID controllers.',...
      '      Proceedings IEE, Pt D, 1993, 140: 216-224',...
      '  [2] D Xue and D P Atherton, Feedback Control Systems (Lecture Notes)');
case 16,
   hlp_Title='LQG Controller Design';
   hlp_Contents=str2mat(...
      'LQG (Linear Quadratic Gaussian) controller design are allowed in CtrlLAB ',...
      'for the plant model',' ',...
      '    dx(t)/dt=A x(t)+B u(t)+\Gamma w(t), y(t)=C x(t)+v(t)',' ',...
      'where w(t) and v(t) are Gaussian signals with ',' ',...
      '    E[w(t)w^T(t)]=\Xi \geq 0, E[v(t)v^T(t)]=\Theta >0',' ',...
      'The optimisation criterion is defined as',' ',...
      '    J=\int_0^\infty z^T(t) Q z(t)+u^T(t) R u(t) dt',' ',...
      'where z(t)=M x(t).  Assume that R=1, and one should supply matrix Q, ',...
      'as well as the variance \Xi and \Theta, then click {\itDesign} button to find a LQG ',...
      'controller.');
case 17,
   hlp_Title='LQG/LTR Controller Design';
   hlp_Contents=str2mat(...
      'LQG (Linear Quadratic Gaussian) controller design are allowed in CtrlLAB ',...
      'for the plant model',' ',...
      '    dx(t)/dt=A x(t)+B u(t)+\Gamma w(t), y(t)=C x(t)+v(t)',' ',...
      'where w(t) and v(t) are Gaussian signals with ',' ',...
      '    E[w(t)w^T(t)]=\Xi \geq 0, E[v(t)v^T(t)]=\Theta >0',' ',...
      'The optimisation criterion is defined as',' ',...
      '    J=\int_0^\infty z^T(t) Q z(t)+u^T(t) R u(t) dt',' ',...
      'where z(t)=M x(t).  Assume that R=1, and one should supply matrix Q, ',...
      'as well as the variance \Xi and \Theta, then click {\itDesign} button to find a LQG ',...
      'controller.',' ',...
      'LTR (Loop Transfer Recovery) technique is useful to recover the loop transfer',...
      'function under observer-based technique.  An large value of q should be used',...
      'to recover the loop gain.');
case 18,
   hlp_Title='H-norm Based Controller Design';
   hlp_Contents=str2mat(...
      'Two kinds of weightings are supported:',' ',...
      '   1) {\bfMixed sensitivity} problem: with ',...
      '       T_{yu}(s)=[W_1 S(s); W_2 G_c(s) S(s); W_3 T(s)];',...
      'where S(s) and T(s) are sensitivity and complementary senitivity',...
      'functions.  and W_1(s), W_2(s), and W_3(s) are the weighting functions. ',...
      'One may enter the weighting functions for W_1-W_3(s) and also to display ',...
      'their Bode diagrams using the related push buttons.',' ',...
      '   2) {\bfSensitivity} problem: with T_{yu}(s)=W_1 S(s), and W_1(s) selected from ',...
      'the standard transfer functions of the order and natural frequency \omega_n of the',...
      'user''s choice.   For the standard model selection, the ITAE I, ITAE II and ',...
      'Butterworth model are allowed.',' ',...
      'Three such controller are allowed:',' ',...
      '   1) H_2 Controller,  2) H_\inftyController, and 3) Optimal H_\inftyController',' ',...
      'The Robust Control Toolbox of MATLAB should be used to complete the ',...
      'design of the robust controllers.  All the controller designed are observer-',...
      'based.');
case 19,
   hlp_Title='Plot Preference Options';
   hlp_Contents=str2mat(...
      'In this dialog box, the settings for the graphics windows in CtrlLAB can be',...
      'specified.  Once everything one wants to modify is specified, one can press',...
      '{\itChange} button to confirm the changes, and press the {\itDefault} button to set',...
      'the properties back to default ones.  ',' ',...
      '{\itGrid} group: tanggle the grids to the plot with on/off options.',' ',...
      '{\itBox} group: tanggle the boxes on the plot with on/off options.',' ',...
      '{\itApply} group: Allow the user to select whether he wants to set the specified ',...
      'changes to the {\itCurrent} graph, or the {\itAll} graphics windows.',' ',...
      'In {\itPlot Color} group, one can set the background color, and the color of',...
      'the figures.  Once can also set the color back to default.',' ',...
      'The {\itLoop} group: allow the user to set the system to be studied to {\itOpen Loop}',...
      'or {\itClosed Loop}.',' ',...
      'The {\itCombinations} group: One can set the model to be analysed to {\itUncom-}',...
      '{\itpensated} and {\itCompensated} using the multiple selectable boxes.  If the ',...
      'controller dose not exist, the latter is grayed.');
case 20,
   hlp_Title='Using the Zooming Facilities';
   hlp_Contents=str2mat(...
      'The {\bfZooming} menu allows the user to do zoomings to the current graphics',...
      'window.  The following menus are useful.',' ',...
      '{\bfZooming} menu allows one to use mouse button to drag the range one ',...
      '    interested.  Also once selected, one can use left and mouse button to click',...
      '    the graph to enlarge or reduce the graph.',' ',...
      '{\bfX-axis Zooming} and {\bf Y-axis Zooming} menus allows one to perform ',...
      '    zooming functions to x- and y-axis only.',' ',...
      'The {\bfFull} menus allows one to set the current axes in an automatic way, ',...
      'according to the actual data set in the graph.',' ',...
      'The {\bfUser Define} menu brings out the current dialog box, and from here',...
      'one can specify the zooming ranges using keyboard.  One can spefify ',...
      '{\itX-Axis} and {\itY-Axis} separately.  One can either select the {\itCurrent} or to select ',...
      '{\itDefine}, where one can set the lower and upper values in the edit boxes.',' ',...
      'Please note that, for graphics windows with more than one figures, such as ',...
      'the case in Bode diagram, one should select the one he is interested in by ',...
      'clicking the figure (an effective way is to click the axis labels), before the ',...
      'zooming function can be applied.');
case 21,
   hlp_Title='Using the Legend Facilities';
   hlp_Contents=str2mat(...
      'The {\bfLegend} menu allows the user to add and edit legends to the graphs.  The',...
      '{\itlabels, cursor positioning, line} and {\itrrows} can be added to the plot.  The',...
      'following menu items are provided in the menu:',' ',...
      '{\bfNew Legend} shows a legends editting box, and you can enter any text in the',...
      '    box, and then click {\bf Apply} button, then move the mouse to the position ',...
      '    you want to add the legend, and click the mouse button.  The legend will ',...
      '    then be added.',' ',...
      '{\bfEdit Legend}, {\bfMove Legend} and {\bfDelete Legend} menus allows one to edit ',...
      '    legends of his choice, using the mouse.',' ',...
      '{\bfAdd a Line} and {\bfAdd an Arrow} menus allows one to add line or arrow to the',...
      '    graphs.  One should use mouse to click for the starting and ending points ',...
      '    of the legends.',...
      '{\bfCursor Positioning} menu allows one to select and label one point on the',...
      '    curves in the graphs.',' ',...
      '{\bfProperties} menu will bring a dialog box, so that one can edit the properties ',...
      '    of the legends he added, such as to change font to the labels, to change the ',...
      '    color and line stypes to line and arrors.',' ',...
      'This facility is also applicable to curve editting.');
case 22,
   hlp_Title='About the Matrix Processor';
   hlp_Contents=str2mat(...
      'The {\bfMatrix Processor} is a GUI-based matrix processing program.  The',...
      'function can be used to display the matrix and state space models, and ',...
      'one can perform analysis to the matrix (or coefficient matrix in the',...
      'system), such as evaluating parameters and decompositions.',' ',...
      '{\bfFile} menu is used to save and load new matrix from files.',' ',...
      '{\bfEdit} menu allows the editting to matrix (system) element in a graphical',...
      '    way, and allows the display of matrix in MATLAB or LaTeX format.',' ',...
      '{\bfFormats} menu defines the displaying format, such as precision.',' ',...
      '{\bfAnalysis} menu performs analysis to matrix parameters, manipulations',...
      '    of matrices, decompositions and function evaluations.',' ',...
      'Matrix Processor can be used as a separate program, or used as part of ',...
      'CtrlLAB.  In stand alone format, one can call the function in:',' ',...
      '   matx\_proc(A) or matx\_proc format.');
case 23
   shw_about('About CtrlLAB','CtrlLABExtras',...
      'Feedback Control LAB Program','CtrlLAB\copyright Version 3.0,  1996-1999');
   bHelp=0;
case 24
   shw_about('About Matrix Processor','MatxProcExtras',...
      'A GUI-based Matrix Processor','for CtrlLAB\copyright 3.0, 1996-1999');
   bHelp=0;
case 25
   hlp_Title='Model Following Controller Design';
   hlp_Contents=str2mat(...
      'To be added to the system',...
      'now is being written');
case 26
   hlp_Title='Model Reduction Comparisons';
   hlp_Contents=str2mat(...
      'Under CtrlLAB, the user is allowed to compare the reduced order model',...
      'with the original model in a number of specifications in open loops.  For ',...
      'instance, one can compare the Bode diagram, step responses, which can be ',...
      'done by selecting corresponding terms from the list box.  ',' ',...
      'One can also compare many of the reduced order models together with that ',...
      'of the original model. This can be done by selecting the reduced order models ',...
      'from the list on the left.  One can specify as many terms as he like.  If none ',...
      'is selected from the list, then only the original model is analysed.',' ',...
      'If multiple models are compared, then we use blue for the original model, and ',...
      'for reduced order models, the following color order appliesto the subsequent ',...
      'reduced models from the list:',' ',...
      '     {\bfgreen} ([0,0.5,0]), {\bfred} ([1,0,0]), {\bfblue-green} ([0,0.5,0.5]), ',...
      '     {\bfpurple} ([0.75,0,0.75]), {\bfyellow-green} ([0.75,0.75,0]), ',...
      '     {\bfblack} ([0.23,0.25,0.25]), {\bflight purple} ([0.5,0.25,0.75])',' ',...
      'If one wants to display a certain reduced model, he can select that model',...
      'ONLY and click {\itShow} button.',' ',...
      'It is worth mentioning that if SIMULINK model is involved, then for time',...
      'response comparison is based on exact model, if {\itUse SIMULINK} is selected.',...
      'The frequency domain analysis uses the linearised model all the time. ');
case 27
   shw_about('About Graf_Tools','CtrlLABExtras',...
         'Graphics Facilities Program','for CtrlLAB\copyright Version 3.0, 1996-1999');
   bHelp=0;
case 28
   hlp_Title='About Creating a New Matrix';
   hlp_Contents=str2mat(...
      'In this dialog box, two methods of entering a new matrix are provided.  They ',...
      'are summarised as follows:',' ',...
      '  1) {\bfDirect method}',...
      '     In this method, one should enter in the top edit box the matrix in',...
      '     MATLAB format.  ',' ',...
      '  2) {\bfTemplate method}',...
      '     In this method, one should specify the format of the matrix in the list ',...
      '     box, and if necessary, the number of rows, columns and a given vector',...
      '     should be provided.  For instance, if one wants to enter a zero matrix, ',...
      '     he should only specify the numbers of rows and columns.  If he wants ',...
      '     to enter a matrix in companion form, then he should enter the known ',...
      '     vector, [a_1, ..., a_n] such that, the matrix will be formulated in the form:',' ',...
      '           -a_1  -a_2   -a_3 ...   -a_n',...
      '            1      0     0   ...   0',...
      '            0      1     0   ...   0',...
      '           ...    ...   ...       ...',' ',...
      '    It should be noted that, if the matrix in the first method, i.e., in the edit ',...
      'box has been specified, it should be evaluated, no matter what have been',...
      'specified in the other method.');
case 29   
   hlp_Title='About Graphics Toolbox^{\copyright}';
   hlp_Contents=str2mat(...
      'Graphics Toolbox is used either as an independent program, or used with',...
      'CtrlLAB to decorating the graphs.  The user can add legends, line and arrows ',...
      'to the graphs obtained, or to use zooming facilities to have a better view.  ',...
      'The user is also allowed to save the graph elements to files such that the ',...
      'whole graphs can be recalled later.  This also applies to a window with',...
      'multiple curves.  ',' ',...
      'In {\bfFile} menu, one is allowed to Save/Load graph elements to certain files, ',...
      'using the data structure defined in the toolbox.',' ',...
      'In this menu, one is allowed to change Box and Grid facilities in the graphics',...
      'window.  Also the setting in the graphs can further be the {\itPreferences} menu',...
      'which gives a dialog box.  {\itPrint} menu allows one to print the current figure',...
      'or copy it to clipboard the graphs.  Also saving of the graphs in EPS format ',...
      'is allowed.',' ',...
      '{\bfLegends}, {\bfZooming} and {\bfCurves} menus will be given in the Help windows.',' ',...
      'If it is used as an individual program, then one can use any graphics command ',...
      'to draw curves on the window and can modify and decorating the curves with ',...
      'this very easily.',' ',...
      'Graphics Toolbox is now only available for 2D graphics.');
case 30   
   hlp_Title='About Curve Editing Facilities';
   hlp_Contents=str2mat(...
      'The {\bfCurve} menu in the Graphics Toolbox allows one to edit certain facilities',...
      'of curves on the current graphics window.',' ',...
      '{\bfDelete a Certain Curve} menu allows one to delete a curve on the graph.',...
      'If one selects such a item, then a cross cursor will occur to prompt the user',...
      'to select a curve to delete on the graph.  If one does not want to delete that',...
      'curve, he can click the right mouse button to cancel.',' ',...
      '{\bfChange Curve Color} allows one to change the color of a curve in an interact',...
      'way.  When a curve is selected, the color palette will appear.  One can use ',...
      'this method to change the color.',' ',...
      'One can also change line style, markers, line thickness to the curve selected.',' ',...
      'The overall properties can also be modified by {\bfProperties} menu, which will',...
      'open a dialog box for modifying it.');
case 31   
   hlp_Title='Changing Plot Ranges';
   hlp_Contents=str2mat(...
      'To be added to the system',...
      'now is being written');
otherwise   
   warndlg('Help messages not available yet!','Warning: Program incomplete!');
   bHelp=0;
end

% if help information is available, then the help window is displayed
if bHelp==1
   help_window(hlp_Title, hlp_Contents, 'CtrlLAB 3.0',nTask);
end

%---------------------------------------------------------
%shw_about display the About dialog box in CtrlLAB.
%
%   shw_about(winTitle,winTag,strText1,strText2)
%where
%  winTitle -- contains the title of the About window 
%  winTag   -- contains the tag of the About window
%  strText1 -- the main information of the About window
%  strText2 -- the version display of the About window
%---------------------------------------------------------
function shw_about(winTitle,winTag,strText1,strText2)
h_win=findobj('Name',winTitle);
if length(h_win)==0
   h_win=figure('Units','normalized','Position',[0.24875 0.248 0.4375 0.25],...
      'NumberTitle','off','Name',winTitle,'MenuBar','none','Color',[0.502,1,1],...
      'Tag',winTag,'Resize','off');
   MyColor=[0.1,1,1]; extra_funs(1); hold on; 
   x1=[0,1,1,0,0]; y1=[0.95,0.95,1,1,0.95]; w=[0,0,0.6275]; w0=w; dw=[0,0.0476,0.0177]/2;
   for i=1:40
      fill(x1,y1,w); h=plot(x1,y1); set(h,'Color',w); y1=y1-0.025; w=w+dw;
   end
   display_str(0.06,0.83,strText1,[1,0,0],'on',20,'Brush Script MT','bold'); 
   display_str(0.1,0.65,strText2,[0,0,0],'on',13,'Times New Roman','bold');
   display_str(0.19,0.47,'Author: Professor Dingyu Xue',...
      [0.8,0,0],'on',11,'Century Schoolbook','bold','italic');
   display_str(0.175,0.36,'Northeastern University, P.R. China',[1,0,0],...
      'on',11,'Century Schoolbook');
   uicontrol('Style','PushButton','String','OK',...
      'Units','normalized','Position',[0.4 0.07 0.20 0.16],...
      'CallBack','close(gcf)')
else, figure(h_win); end

%---------------------------------------------------------
%help_window display the help information in CtrlLAB.
%
%   help_window(titleStr,helpStr,win_name,nTask)
%where
%  titleStr -- contains the title of the help information 
%  helpStr  -- contains the information contents
%  win_name -- the name of the Help window
%  nTask    -- the code of help information
%---------------------------------------------------------
function help_window(titleStr,helpStr,win_name,nTask)

% If the Help Window has already been created, bring it to the front
bCont=0; 

helpw_h=findobj('Tag','CtrlLABHelp');
% if the window has not been opened, create a new window
if length(helpw_h)==0,
   %if Help window dose not exist, then open a new Help window
   helpw_h=figure('Units','normalized','Position',[0.48625 0.1983 0.5 0.77],...
      'NumberTitle','off','Name',[win_name ' Help Window'],...
      'MenuBar','none','Color',0.8*[1,1,1],...            
      'Tag','CtrlLABHelp','Resize','off');
   extra_funs(1);
   uicontrol('Style','PushButton','String','Close Help Window',...
      'Units','normalized','Position',[0.70,0.02,0.28,0.05],...
      'Callback','delete(gcf)');
else
   %if it already opened, then close it and open again with 
   %new contents, since in this way, the speed for updating
   %the help information is faster.
   close(helpw_h); help_window(titleStr,helpStr,win_name,nTask);
end

%Display help information in the Help window
kk=get(gcf,'UserData');
if (length(kk)>0 & kk(1)~=nTask) | length(kk)==0,
   delete(gca), yL=0.91; extra_funs(1);

%Display help title
   display_str(0.04,0.96,['{\bf\it' titleStr ,'}'],[0.5020,0,0.2510],'on',12);

%display help information
   [nr,nc]=size(helpStr);
   for i=1:nr,
      if length(deblank(helpStr(i,:)))>0
         display_str(0.04,yL,helpStr(i,:),[0,0,0],'on',9); yL=yL-0.04;
      else, yL=yL-0.015; end
   end
   set(gcf,'UserData',nTask);
end