function rob_con

% ROB_CON Show the help for the functions in this toolbox.

% This file is automatically generated.  Matthew Simoneau, 09-04-98
% Copyright (c) 1984-98 by The MathWorks, Inc. All Rights Reserved
% $Revision: 1.10 $ $Date: 1998/10/16 23:19:38 $

helpwin('rob_con/Contents');

function Contents
%MATLAB Tour Partial Function Help:  rob_con
%
%Double click on any function for more information
%
%  Robust Control Toolbox.
%  Version 2.0.6 (R11) 10-Apr-1998
% 
%  New Features.
%    Readme      - Important release information about the Robust Toolbox
%                  (double click on Readme, or type "whatsnew directoryname",
%                   i.e. "whatsnew robust" to display this file).
% 
%  Optional System Data Structure.
%     branch    - extract branches from a tree.
%     graft     - add a branch to a tree.
%     issystem  - identify a system variable.
%     istree    - identify a tree variable.
%     mksys     - build tree variable for system.
%     tree      - build a tree variable.
%     vrsys     - returns standard system variable names.
% 
%  Model Building.
%     augss     - plant augmentation (for state space models).
%     augtf     - plant augmentation (for transfer functions).
%     interc    - general multivariable interconnected system.
% 
%  Model Conversions.
%     bilin     - multivariable bilinear transformation.
%     des2ss    - convert descriptor system to system state space via SVD.
%     lftf      - linear fractional transformation.
%     sectf     - sector transformation.
%     stabproj  - stable/antistable projection.
%     slowfast  - slow/fast decomposition.
%     tfm2ss    - convert transfer functions to state-space models.
% 
%  Utility.
%     aresolv   - generalized continuous time Riccati solver.
%     daresolv  - generalized discrete time Riccati solver.
%     riccond   - continuous time Riccati equation condition number.
%     driccond  - discrete time Riccati equation condition number.
%     blkrsch   - block ordered real Schur form via cschur.
%     cschur    - ordered complex Schur form via complex Givens rotation.
% 
%  Multivariable Bode Plot.
%     cgloci    - continuous characteristic gain loci.
%     dcgloci   - discrete characteristic gain loci.
%     dsigma    - discrete singular-value Bode plot.
%     muopt     - SSV upper bound for system with mixed real/complex uncertainty.
%                 (Michael Fan's MUSOL4)
%     osborne   - SSV upper bound via Osborne method.
%     perron    - Perron eigenstructure SSV.
%     psv       - Perron eigenstructure SSV.
%     sigma     - continuous singular-value Bode plot.
%     ssv       - structure singular value Bode plot.
% 
%  Factorization Techniques.
%     iofc      - inner-outer factorization (column type).
%     iofr      - inner-outer factorization (row type).
%     sfl       - left spectral factorization.
%     sfr       - right spectral factorization.
% 
%  Model Reduction Methods.
%     balmr     - truncated balanced model reduction.
%     bstschml  - relative error Schur model reduction.
%     bstschmr  - relative error Schur model reduction.
%     imp2ss    - impulse response to state-space realization.
%     obalreal  - ordered balanced realization.
%     ohklmr    - optimal Hankel minimum degree approximation.
%     schmr     - Schur model reduction.
% 
%  Robust Control Synthesis Methods.
%     h2lqg     - continuous time H_2 synthesis.
%     dh2lqg    - discrete time H_2 synthesis.
%     hinf      - continuous time H_infinity synthesis.
%     dhinf     - discrete time H_infinity synthesis.
%     hinfopt   - gamma-iteration of H_infinity synthesis.
%     normh2    - calculate H_2 norm.
%     normhinf  - calculate H_infinity norm.
%     lqg       - LQG optimal control synthesis.
%     ltru      - LQG loop transfer recovery.
%     ltry      - LQG loop transfer recovery.
%     youla     - Youla parameterization.
% 
%  Demonstration.
%     accdemo   - spring-mass benchmark problem.
%     dintdemo  - H_infinity design for double-integrator plant.
%     hinfdemo  - H_2 & H_infinity design examples.
%                    fighter & large space structure.
%     ltrdemo   - LQG/LTR design examples -fighter.
%     mudemo    - mu-synthesis examples.
%     mudemo1   - mu-synthesis examples.
%     mrdemo    - robust model reduction examples.
%     rctdemo   - robust control toolbox demo - main menu.
%     musldemo  - MUSOL4 demo.
%

function Readme
%MATLAB Tour Partial Function Help:  rob_con
%
%  Robust Control Toolbox 2.0.4
%  for use with MATLAB 5.1 and Control System Toolbox 4.0
%  or later.
% 
%  Installation: Delete current toolbox/robust directory and
%                replace with these updated files.
% 
%  Notice:   These files are not compatible with earlier
%            MATLAB 4.2c and Control System Toolbox 3.1
% 

function branch
%MATLAB Tour Partial Function Help:  rob_con
%
%  BRANCH Branch of "TREE" variable (optional system matrix data structure).
% 
%  [B1,B2,...,BN] = BRANCH(SYS) or
%  [B1,B2,...,BN] = BRANCH(SYS,V1,...VN) returns N system data
%      matrices [B1,...,BN] from an LTI system; optional inputs V1,...VN
%      are string names of variables to be retrieved. The list of
%      valid names V1,...,VN for SYS is returned by BRANCH(SYS,0).
% 
%  [B1,B2,...,BN] = BRANCH(TR,PATH1,PATH2,...,PATHN) returns N sub-branches
%      of a tree variable created by TREE.  If NARGIN==1, the root branches
%      are returned in sequence by numerical index; otherwise, the
%      branches returned are determined by the paths PATH1, PATH2,...,PATHN.
%      Each path is normally a STRING of the form
%            PATH = '/name1/name2/.../namen'
%      where name1,name2, et cetera are the string names of the branches
%      which define the path from the tree root to the sub-branch of
%      interest.  Alternatively, one may substitute for any PATH a row
%      vector containing the integer indices of the branches which define
%      the PATH.  For example, if S=TREE('a,b,c','foo',[49 50],'bar') then
%      BRANCH(S,'c') and BRANCH(S,3) both return the value 'bar'.
% 
%   

function graft
%MATLAB Tour Partial Function Help:  rob_con
%
% GRAFT Add root branch onto "TREE" vector.
% 
%  TR1 = GRAFT(TR,B)
%  TR1 = GRAFT(TR,B,NM) adds root branch B onto tree vector TR (previously
%      created by TREE or MKSYS). If TR has N branches then the numerical
%      index of the new root branch is N+1; and the numerical indices
%      of the other root branches are unchanged.  The string NM, if
%      present, becomes the name of the new root branch.  Related functions
%      include the following:
%          TREE     creates a tree
%          MKSYS    creates a tree containing matrices describing a system
%          BRANCH   returns branches of a tree
%          ISTREE   tests whether a variable is a tree or not
%          ISBRANCH testw whether a give branch of a tree exists
% 

function issystem
%MATLAB Tour Partial Function Help:  rob_con
%
%  ISSYSTEM System matrix check (LTI or MKSYS or PCK or LTISYS).
% 
%   [I,TY,N]=ISSYSTEM(X) checks whether or not X is a system such
%   as is created by either MKSYS, MKLTI, PCK, LTISS, SS, TF, 
%   or ZPK.  If X is a system, then
%                 I    =  1  
%                 TY   =  MKSYS equivalent system type
%                 N    =  number of matrices in the system (depends on TY)
%   Otherwise, I=0, TY=[] and N=0.
% 
%   

function istree
%MATLAB Tour Partial Function Help:  rob_con
%
% ISTREE Check "TREE" variable.
% 
%  I=istree(X) returns I=1 if X is a tree (e.g, as created by the
%      function TREE); otherwise it returns I=0.
% 
%  [I,B]=ISTREE(X,PATH) returns I=1 if both X is a tree and PATH is
%      a valid PATH in the tree X; otherwise it returns I=0.  If the
%      optional output argument B is present, then B returns the value
%      of the branch specified by PATH, provided X is a tree and PATH
%      is a valid path in X.
% 

function mksys
%MATLAB Tour Partial Function Help:  rob_con
%
%  MKSYS Pack system matrices into "TREE" variable.  
%  S=MKSYS(A,B,C,D) or
%  S=MKSYS(V1,V2,...,VN, TY) packs matrices describing a system into TREE
%  vector S under variable names depending on the STRING TY as follows:
%  -----   -------------------------------          ---------------------------
%  TY      V1,V2,...,VN                             Description
%  -----   -------------------------------          ---------------------------
%  'ss'    'a,b,c,d[,Ts],ty'                        Standard Statespace (default)
%  'des'   'a,b,c,d,e[,Ts],ty'                      Descriptor System
%  'tss'   'a,b1,b2,c1,c2,d11,d12,d21,d22[,Ts],ty'  Two-port Statespace
%  'tdes'  'a,b1,b2,c1,c2,d11,d12,d21,d22,e[,Ts],ty'Two-port Descriptor
%  'gss'   'sm,dimx,dimu,dimy[,Ts],ty'              General statespace
%  'gdes'  'e,sm,dimx,dimu,dimy[,Ts],ty'            General descriptor
%  'gpsm'  'psm,deg,dimx,dimu,dimy[,Ts],ty'         General polynom. sys. matrix
%  'tf'    'num,den[,Ts],ty'                        Transfer function
%  'tfm'   'num,den,m,n[,Ts],ty'                    Transfer function matrix
%  'imp'   'y,ts,nu,ny[,Ts],ty'                     Impulse response
%  ----------------------------------------------------------------------
%  The optional input Ts (sampling time), if non-zero, tags the system as 
%  discrete-time; a negative Ts=-1 indicates sampling time is unspecified.
%  The BRANCH function recovers matrices packed into S, e.g., the 'c'
%  and 'a' matrices from a standard statespace system S are returned by
%  the command [C,A,Ts]=BRANCH(S,'c,a,Ts').  Alternatively, the command
%  [AG,BG,CG,DG,TY]=BRANCH(S) returns the matrices (except for Ts) 
%  in the order in which they were originally packed.
% 
%  

function tree
%MATLAB Tour Partial Function Help:  rob_con
%
% TREE Hierarchical data structure.
% 
%  TR = TREE(NM,B1,B2,...,BN) creates a hierarchical data structure TR
%      called a "tree"  consisting of a single column vector into which
%      is encoded all the data and dimension information from its
%      branches B1, B2,...,BN along with a numerical index and a string-
%      name for each branch. The input argument NM assigns names to the
%      branches; it must be of the form
%            NM = 'name1,name2,...,nameN'
%      The names may be any valid MATLAB variable names and must be
%      separated by commas; if no names are to be assigned, set NM=''.
%      The arguments B1,B2,...,BN (called the "root branches" of the
%      tree) may be matrices, vectors, strings, or trees themselves.
%      Related functions include the following:
%          BRANCH   returns branches of a tree
%          ISTREE   tests existence of a specified branch
%          BRANCH(TR,0)  returns NM
%          TR(1)    returns the number N of root branches
% 

function vrsys
%MATLAB Tour Partial Function Help:  rob_con
%
% VRSYS Verify system matrix type.
% 
%  [VARS,N] = VRSYS(NAME) returns string VARS and an integer N where VARS
%       contains the list of N variable names associated with a system
%       having system name NAME.  A valid system name is a string of the form
%              NAME = [TY '_' SUF]
%       where SUF is a suffix string which is appended to standard
%       variable names in a list determined by the string TY as follows:
%  -----   -------------------------------  ---------------------------
%  TY      VAR prior to appending suffixes  Description
%  -----   -------------------------------  ---------------------------
%  'ss'    'a,b,c,d'                        Standard State-space (default)
%  'des'   'a,b,c,d,e'                      Descriptor System
%  'tss'   'a,b1,b2,c1,c2,d11,d12,d21,d22'  Two-port State-space
%  'tdes'  'a,b1,b2,c1,c2,d11,d12,d21,d22,e'Two-port Descriptor
%  'gsm'   'sm,dimx,dimu,dimy'              General state-space
%  'gdes'  'e,sm,dimx,dimu,dimy'            General descriptor
%  'gpsm'  'psm,deg,dimx,dimu,dimy'         General polynom. sys. matrix
%  'tf'    'num,den'                        Transfer function
%  'tfm'   'num,den,n,m'                    Transfer function matrix
%  'sm'    'sm,dim'                         State-space system matrix
%  'tsm'   'tsm,dim'                        Two-port state-space sys. mat.
%  'imp'   'y,ts,nu,ny'                     Impulse response
%  ----------------------------------------------------------------------
%  A capital TY string returns the string VAR as above, but in capitals.

function augss
%MATLAB Tour Partial Function Help:  rob_con
%
% AUGSS Augmentation of W1,W2,W3 (state-space form) into two-port plant.
% 
%   [TSS_] = AUGSS(SS_G,SS_W1,SS_W2,SS_W3,W3POLY) or
%   [A,B1,B2,C1,C2,D11,D12,D21,D22] = AUGSS(AG,BG,CG,DG,AW1,BW1,CW1,DW1,...
%    AW2,BW2,CW2,DW2,AW3,BW3,CW3,DW3,W3POLY) computes the state-space model
%    of a plant augmented with weightings as follows:
% 
%        W1 = ss_w1 = mksys(aw1,bw1,cw1,dw1); ---- on 'e', the error signal
%        W2 = ss_w2 = mksys(aw2,bw2,cw2,dw2); ---- on 'u', the control signal.
%        W3 = ss_w3 + w3poly ---- on 'y', the output signal
%     where
%        ss_w3 = mksys(aw3,bw3,cw3,dw3);
%        w3poly := polynomial-matrix in descending powers (optional input)
%                = [w3(n),w3(n-1),...,w3(0)]
%                  with size(w3(i))=size(dw3) for i=0,1,...,n.
% 
%     Note: 1) Any of the above weightings can be removed by setting
%              ss_w1 or ss_w2, ss_w3 equal to mksys([],[],[],[]).
%           2) w3poly defaults to [], if omitted.
% 
%     The augmented system TSS_=mksys(A,B1,B2,C1,C2,D11,D12,D21,D22,'tss').

function augtf
%MATLAB Tour Partial Function Help:  rob_con
%
% AUGTF Augmentation of W1,W2,W3 (transfer function form) into two-port plant.
% 
%  [TSS_] = AUGTF(SS_G,W1,W2,W3) or
%  [A,B1,B2,C1,C2,D11,D12,D21,D22] = AUGTF(AG,BG,CG,DG,W1,W2,W3)
%  produces an augmented state-space realization for H2/Hinf control
%  system design, where
%          ss_g = mksys(ag,bg,cg,dg); (original plant state-space)
% 
%          w1   = diagonal weighting matrix on "e"
%               = [N11;D11;N22;D22;....]
% 
%          w2   = diagonal weighting matrix on "u"
%               = [N11;D11;N22;D22;....]
% 
%          w3   = diagonal weighting matrix on "y", but allow polynomial
%          matrix at frequency infinity (i.e., w3(s) = sysw3 + w3poly(s))
%               = [N11;D11;N22;D22;....]
% 
%   The resulting state-space sysw1, sysw2, and W3(s) = sysw3 + w3poly(s)
%   are passed on to AUGSS.M to compute the final state-space.
% 
%   If one of the weightings is missing, simply assign an empty bracket: [].

function interc
%MATLAB Tour Partial Function Help:  rob_con
%
% INTERC State-space interconnected system.
% 
%  [SS_CL] = INTERC(SS_,M,N,F) or
%  [ACL,BCL,CCL,DCL] = INTERC(A,B,C,D,M,N,F) produces a state space
%         realization of the interconnected system, given system
%         G:(A,B,C,D) and constant blocks -- M, N and F representing
%         the interconnections. The general set-up is as follows:
% 
%            - - -    +          - - -           - - -
%    R ----->| M |----->0------->| G |---------->| N |------> Y
%            - - -      ^ +      - - -      |    - - -
%                       |                   |
%                       |        - - -      |
%                       ---------| F |<------
%                                - - -
%  Note: ss_ = mksys(a,b,c,d);
%
% Overloaded methods
%    help lti/interc.m

function bilin
%MATLAB Tour Partial Function Help:  rob_con
%
% BILIN State-space bilinear transform.
% 
%  [SS_B] = BILIN(SS_,VERS,METHOD,AUG) or
%  [AB,BB,CB,DB] = BILIN(A,B,C,D,VERS,METHOD,AUG) performs a frequency
%       plane bilinear transform:
%           az + d                           d - bs
%     s = ---------  (if vers = 1); or z = ----------  (if vers = -1)
%           cz + b                           cs - a
%    such that
%                     -1                                -1
%        G(s) = C(Is-A) B + D <-------> G(z) = Cb(Iz-Ab)  Bb + Db
%  --------------------------------------------------------------------------
%    'Tustin' ----- Tustin Transform (s = 2(z-1)/T(z+1), aug = T).
%    'P_Tust' ----- Prewarped Tustin (s = w0(z-1)/tan(w0*T/2)(z+1),
%                                   aug = (T,w0), w0:prewarped freq.)
%    'BwdRec' ----- Backward Rectangular (s = (z-1)/Tz, aug = T).
%    'FwdRec' ----- Forward Rectangular (s = (z-1)/T, aug = T).
%    'S_Tust' ----- Shifted Tustin (2(z-1)/T(z/sh+1), aug = (T,sh),
%                                 sh: shifted circle coeff.).
%    'Sft_jw' ----- Shifted jw-axis Bilinear (aug = (b1,a1), circle coeff.).
%    'G_Bili' ----- General Bilinear (s = (az+d)/(cz+b), aug = (a,b,c,d)).
%        (Note: these options are NOT case sensitive anymore!)
%  -------------------------------------------------------------------------
%
% Overloaded methods
%    help lti/bilin.m

function des2ss
%MATLAB Tour Partial Function Help:  rob_con
%
% DES2SS Convert descriptor state-space form into regular state-space form.
% 
%  [SS_D] = DES2SS(SS_DES,K) or
%  [AD,BD,CD,DD] = DES2SS(A,B,C,D,E,K) reduces the descriptor form system
%    into the regular state-space form via SVD of the descriptor E.
% 
%    Input Data: ss_des = mksys(a,b,c,d,e,'des');
%    Optional Input Data: k = dim. of the null space of E
%    Output Data: ss_d  = mksys(a,b,c,d);

function lftf
%MATLAB Tour Partial Function Help:  rob_con
%
% LFTF Two-port linear fractional transformation.
% 
%  [TSS_] = LFTF(TSS_1,TSS_2); or [A,B1,B2,..] = LFTF(A11,B11,..,A21,B21,..);
%  [SS_L] = LFTF(TSS_1,SS_2); or [AL,BL,CL,DL] = LFTF(A11,B11,..,AW,BW,CW,DW);
%  [SS_L] = LFTF(SS_1,TSS_2);
%   Produces a linear fractional transform from [U1;U2] to [Y1;Y2]:
%                                 P1(s)
%   optional              ---------------------                optional
%   U1 (nu1) -----------> | P11(s)     P12(s) | -------------> Y1 (ny1)
%                -------> | P21(s)     P22(s) | -------
%                |        ---------------------       |
%                |      (nx  no. of states of P s))   |
%                |        ---------------------       |
%   optional     -------- | P11(s)     P12(s) |<-------        optional
%   Y2 (ny2) <----------- | P21(s)     P22(s) |<---------------U2 (nu2)
%                         ---------------------
%                                 P2(s)

function sectf
%MATLAB Tour Partial Function Help:  rob_con
%
% SECTF Sector transformation.
% 
%  [SYSG,SYST] = SECTF(SYSF,SECF,SECG); or
%  [AG,BG,CG,DG,AT,BT1,...,DT21,DT22]=SECTF(AF,BF,CF,DF,SECF,SECG); or
%  [AG,BG1,...,DG22,AT,BT1,...,DT21,DT22]=SECTF(AF,BF1,...,DF22,SECF,SECG);
% 
%  SECTF computes the sector transformed system G(s) such that I/O pairs
%  (Ug,Yg) of G(s) are in sector SECG if and only the corresponding M-vector
%  I/O pairs (Uf,Yf) of F(s) are in are in sector SECF.  Also computed is
%  a linear fractional transformation T(s) such that SYSG = LFTF(SYST,SYSF).
%  INPUTS: SYSF -- A SYSTEM in either 'ss' or 'tss' form; or the
%                  corresponding list of matrices AF,BF,CF,DF or
%                  AF,BF1,BF2,CF1,CF2,DF11,DF12,DF21,DF22; if 'tss'
%                  form then the sector transform is applied to (Uf1,Yf1).
%    SECF,SECG  -- Sectors in one of the following forms:
%          Form:                       Corresponding Sector:
%          [A,B] or [A;B]              0> <Y-AU,Y-BU>
%          [A,B] or [A;B]              0> <Y-diag(A)U,Y-diag(B)U>
%          [SEC11 SEC12;SEC21,SEC22]   0> <SEC11*U+SEC12*Y,SEC21*U+SEC22*Y>
%    where A,B are scalars in [-Inf,Inf] or square MxM matrices or M-vectors;
%    and SEC=[SEC11,SEC12;SEC21,SEC22] is either a matrix or a 'tss' SYSTEM
%    with either 1x1 (scalar) or MxM blocks SEC11,SEC12,SEC21,SEC22.
%  OUTPUTS:  SYSG -- G(s) in  same form as F(s) (e.g., 'ss' or 'tss' form)
%            SYST -- T(s) in 'tss'form; or list of matrices AT,BT1,...,DT22.
% 
%  

function stabproj
%MATLAB Tour Partial Function Help:  rob_con
%
% STABPROJ State-space stable/anti-stable decomposition.
% 
%  [SS_1,SS_2,M] = STABPROJ(SS_) or
%  [A11H,B1H,C1H,D1H,A22H,B2H,C2H,D2H,M] = STABPROJ(A,B,C,D) produces
%      a decomposition of G(s) as the sum of its stable part G1(s) and
%      its antistable part G2(s) where
% 
%                   G(s):= ss_ = mksys(a,b,c,d);
%                   G1(s):= ss_1 = mksys(a11h,b1h,c1h,d1h);
%                   G2(s):= ss_2 = mksys(a22h,b2h,c2h,d2h);
% 
%   The regular state-space can be recovered by "branch".
%
% Overloaded methods
%    help lti/stabproj.m

function slowfast
%MATLAB Tour Partial Function Help:  rob_con
%
% SLOWFAST State-space slow-fast decomposition.
% 
%  [SS_1,SS_2] = SLOWFAST(SS_,CUT) or
%  [A11H,B1H,C1H,D1H,A22H,B2H,C2H,D2H] = SLOWFAST(A,B,C,D,CUT) produces
%      a decomposition of G(s) into the sum of a slow part Gs(s) and a
%      fast part Gf(s)
% 
%                  G(s) = Gs(s) + Gf(s)
%      where
%                  Gs(s):= ss_1 = mksys(a11h,b1h,c1h,d1h);
%                  cut = no. of modes in Gs(s)
%                  Gf(s):= ss_2 = mksys(a22h,b2h,c2h,d2h);
% 
%    The regular state-space can be recovered by "branch".
%
% Overloaded methods
%    help lti/slowfast.m

function tfm2ss
%MATLAB Tour Partial Function Help:  rob_con
%
% TFM2SS State-space realization of transfer function matrix.
% 
%  [SS_] = TFM2SS(TFM) or
%  [A,B,C,D] = TFM2SS(NUM,DEN,M,N) produces a state space Block Controller
%  (or Observer) form of a Proper Rational Transfer Function Matrix (MIMO)
% 
%                    |N11(s) N12(s) .... N1m(s)|
%      TFM  = 1/d(s) | ........................| = mksys(num,den,m,n,'tfm');
%                    |Nn1(s) ........... Nnm(s)|
% 
%      NUM : a matrix whose rows are the coefficients of the numerators
%            of the TF matrix entries (ie : n11-->row1, n21-->row2, ..etc.).
%      DEN : a row vector contains the coefficients of Characteristic
%            polynomial d(s) (with the highest degree: r).
%      M   : no. of system inputs.
%      N   : no. of system outputs.
% 
%      Note: The resulting A matrix will have "r x min(m,n)" states
%            which is nonminimal. The regular state-space can be recovered
%            "branch".

function aresolv
%MATLAB Tour Partial Function Help:  rob_con
%
% ARESOLV Continuous algebraic Riccati equation solver (eigen & schur).
% 
%  [P1,P2,LAMP,PERR,WELLPOSED,P] = ARESOLV(A,Q,R,ARETYPE) computes the
%  solution to the algebraic Riccati equation
% 
%                      A'P + PA - PRP + Q = 0
% 
%    based on the "aretype" one selects:
% 
%                 aretype = 'eigen' ---- Eigenstructure approach
% 
%                 aretype = 'schur' ---- Schur vector approach
% 
%   Outputs:   P = P2/P1 riccati solution
%              [P1;P2] stable eigenspace of hamiltonian [A,-R;-Q,-A']
%              LAMP closed loop eigenvalues
%              PERR residual error matrix
%              WELLPOSED = 'TRUE ' if hamiltonian has no imaginary-axis
%                   eigenvalues, otherwise 'FALSE'

function daresolv
%MATLAB Tour Partial Function Help:  rob_con
%
% DARESOLV Discrete algebric Riccati equation solver (eigen & schur).
% 
%  [P1,P2,LAMP,PERR,WELLPOSED,P] = DARESOLV(A,B,Q,R,ARETYPE) computes the
%  solution to the discrete algebraic Riccati equation
%                                    -1
%             A'PA - P - A'PB(R+B'PB)  B'PA + Q = 0
% 
%    based on the "aretype" one selects:
% 
%                 aretype = 'eigen' ---- Eigenstructure approach
% 
%                 aretype = 'schur' ---- Schur vector approach
% 
%   Outputs:   P = P2/P1 riccati solution
%              [P1;P2] stable eigenspace of hamiltonian matrix
%              LAMP closed loop eigenvalues
%              PERR residual error matrix
%              WELLPOSED = 'TRUE ' if hamiltonian has no imaginary-axis
%                   eigenvalues, otherwise 'FALSE'

function riccond
%MATLAB Tour Partial Function Help:  rob_con
%
% RICCOND Continuous Riccaci equation condition numbers.
% 
%  [TOT] = RICCOND(A,B,QRN,P1,P2) produces a Riccati condition
%     analysis using the concept of Arnold and Laub (1984).
% 
%     INPUTS:
% 
%       System: (A,B) matrices, and weighting QRN = [Q N;N' R];
%       Riccati Solution: P1,P2 (P = P2/P1)
% 
%     OUTPUT:
% 
%          TOT = [norAc norQc norRc conr conP1 conArn conBey res]
%      where                                         -1            -1
%         norAc, norQc, norRc ----- F-Norm of Ac=(A-BR N'), Qc=(Q-NR N'),
%                                   and Rc = B/R*B'.
%         conr ----- condition number of R
%         conP1 ---- condition number of P1
%         conArn --- Arnold and Laub's Riccati condition number
%         conBey --- Byers's Riccati condition number
%         res ------ residual of Riccati equation
% 

function driccond
%MATLAB Tour Partial Function Help:  rob_con
%
% DRICCOND Discrete Riccati condition numbers.
% 
%  [TOT] = DRICCOND(A,B,Q,R,P1,P2) produces a Riccati condition
%     analysis using the concept of Arnold and Laub (1984).
% 
%     INPUTS:
% 
%       System: (A,B) matrices, and weighting matrices Q, R
%       Riccati Solution: P1,P2 (P = P2/P1)
% 
%     OUTPUT:
% 
%          TOT = [norA norQ norR conr conP1 conArn conBey res]
%      where                                           -1
%         norA, norQ, norR ----- F-Norm of A, Q, and  BR B'
%         conr ----- condition number of R
%         conP1 ---- condition number of P1
%         conArn --- Arnold and Laub's Riccati condition number
%         conBey --- Byers's Riccati condition number
%         res ------ residual of Riccati equation
% 

function blkrsch
%MATLAB Tour Partial Function Help:  rob_con
%
% BLKRSCH Block-ordered real Schur form.
% 
%  [V,T,M] = BLKRSCH(A,ODTYPE,CUT) produces a real block-ordered
%        decomposition of a square real matrix A
% 
%                V'AV = T = |B1  B12|
%                           | 0   B2|
% 
%                B1 = T(1:CUT,1:CUT)
%                B2 = T(CUT+1:END,CUT+1:END)
%                 M = number of stable eigenvalues (s or z plane)
% 
%      Six types of ordering can be selected:
%          odtype = 2 or 3 --- Re(eig(B1)) > Re(eig(B2)).
%          odtype = 1 or 4 --- Re(eig(B1)) < Re(eig(B2)).
%          odtype = 5 --- abs(eig(B1)) > abs(eig(B2)).
%          odtype = 6 --- abs(eig(B1)) < abs(eig(B2)).
% 
%     If ODTYPE <3 & NARGIN<3, then CUT defaults to
%          odtype = 1 --->   CUT = M
%          odtype = 2 --->   CUT = size(A,1)-M

function cschur
%MATLAB Tour Partial Function Help:  rob_con
%
% CSCHUR Ordered complex Schur form.
% 
%  [V,T,M,SWAP] = CSCHUR(A,ODTYPE) produces an ordered Complex Schur form
% 
%               V' * A * V  = T = |T1  T12|
%                                 | 0   T2|,
% 
%               m    = no. of stable poles (s or z plane)
%               swap = total no. of swaps.
% 
%        The unordered Schur form produced by "schur" is ordered using
%        complex Givens rotation to swap adjacent diagonal terms.
% 
%        Six types of ordering can be selected:
% 
%          odtype = 1 --- Re(eig(T1)) < 0, Re(eig(T2)) > 0.
%          odtype = 2 --- Re(eig(T1)) > 0, Re(eig(T2)) < 0.
%          odtype = 3 --- eigenvalue real parts in descending order.
%          odtype = 4 --- eigenvalue real parts in ascending order.
%          odtype = 5 --- modulus of eigenvalues in descending order.
%          odtype = 6 --- modulus of eigenvalues in ascending order.
% 

function cgloci
%MATLAB Tour Partial Function Help:  rob_con
%
% CGLOCI Characteristic Gain/Phase frequency response of continuous systems.
% 	CGLOCI(A,B,C,D) or CGLOCI(SS_) produces a Characteristic Gain/Phase
%        Bode plot of the complex matrix
%                                             -1
%                              G(jw) = C(jwI-A) B + D
% 	as a function of frequency.  The Char. Gain loci are an extension
% 	of Bode magnitude response for MIMO systems.  The frequency range
% 	and number of points are chosen automatically.  For square
% 	systems, CGLOCI(A,B,C,D,'inv') produces the Char. Gain/Phase of the
% 	inverse complex matrix
% 	     -1               -1      -1
%            G (jw) = [ C(jwI-A) B + D ]
% 
% 	CGLOCI(A,B,C,D,W) or CGLOCI(A,B,C,D,W,'inv') uses the user-supplied
% 	frequency vector W which must contain the frequencies, in
% 	radians/sec, at which the Char. Gain/Phase response is to be
% 	evaluated. When invoked with left hand arguments,
% 		[CG,PH,W] = CGLOCI(A,B,C,D,...)
% 	returns the frequency vector W and the matrices CG, PH with as many
% 	columns	as MIN(NU,NY) and length(W) rows, where NU is the number
% 	of inputs and NY is the number of outputs.  No plot is drawn on
% 	the screen.  The Char. Gain are returned in descending order.
% 
% 	

function dcgloci
%MATLAB Tour Partial Function Help:  rob_con
%
% DCGLOCI Discrete characteristic gain/phase frequency response.
% 
% 	DCGLOCI(A,B,C,D,Ts) or DCGLOCI(SS_,Ts) produces a Char. Gain/Phase
%        Bode plot of the complex matrix:
%                                                  -1
%                              G(w) = C(exp(jwT)I-A) B + D
% 	as a function of frequency.  The Char. Gain/Phase are an extension
% 	of the Bode magnitude response for MIMO system.  The frequency
% 	range and number of points are chosen automatically.  For square
% 	systems, DCGLOCI(A,B,C,D,'inv')	produces the Char. Gain/Phase of
% 	the inverse complex matrix
% 	                  -1                    -1      -1
% 	                 G (w) = [ C(exp(jwT)I-A) B + D ]
% 	DCGLOCI(A,B,C,D,Ts,W) or DCGLOCI(A,B,C,D,Ts,W,'inv') use the user-
% 	supplied frequency vector W which must contain the frequencies, in
% 	radians/sec, at which the Char. Gain/Phase response is to be
% 	evaluated. Aliasing will occur at frequencies greater than the
% 	Nyquist frequency (pi/Ts).  When invoked with left hand arguments,
% 		[CG,PH,W] = DCGLOCI(A,B,C,D,Ts,...)
% 	returns the frequency vector W and the matrices CG,PH with
%        MIN(NU,NY) columns and length(W) rows, where NU is the number of
%        inputs and NY is the number of outputs.  No plot is drawn on the
%        screen. The Char. Gain/Phase are returned in descending order.
% 
%   

function dsigma
%MATLAB Tour Partial Function Help:  rob_con
%
% DSIGMA Singular value frequency response of discrete-time linear systems.
%    DSIGMA(A,B,C,D,Ts) (or optional SIGMA(SS_,Ts) in RCT) produces a 
%        singular value plot of matrix:   -1
%                     G(w) = C(exp(jwT)I-A) B + D 
%    as a function of frequency.  The singular values are an extension
%    of Bode magnitude response for MIMO system.  The frequency range 
%        and number of points are chosen automatically. For square systems, 
%        DSIGMA(A,B,C,D,Ts,'inv') produces the singular values of the inverse 
%        matrix     -1                    -1      -1
%              G (w) = [ C(exp(jwT)I-A) B + D ]
%    DSIGMA(A,B,C,D,Ts,W) or DSIGMA(A,B,C,D,Ts,W,'inv') use the user-
%    supplied frequency vector W which must contain the frequencies, in
%    radians/sec, at which the singular value response is to be 
%    evaluated. Aliasing will occur at frequencies greater than the 
%    Nyquist frequency (pi/Ts).  When invoked with left hand arguments,
%            [SV,W] = DSIGMA(A,B,C,D,Ts,...)
%    or  [SV,W] = SIGMA(SS_,Ts,...)    (for Robust Control Toolbox user)
%    returns the frequency vector W and the matrix SV with MIN(NU,NY)
%    columns and length(W) rows, where NU is the number of inputs and
%    NY is the number of outputs.  No plot is drawn on the screen. 
%    The singular values are returned in descending order.
% 
%    

function muopt
%MATLAB Tour Partial Function Help:  rob_con
%
% MUOPT Mixed real/complex sturcture singular value.
% 
%  [r,As,logd,x] = muopt(A) or muopt(A,K) produces the scalar upper bound
%  r on the real or complex structured singular value (ssv) computed via
%  the interior point method of Fan and Nekooie.
%  Input:
%      A  -- an nxn complex matrix whose ssv is to be computed.
%  Optional input:
%      K  -- an nx1 vector whose rows are the uncertainty block sizes
%            for which the ssv is to be evaluated; K must satisfy
%            sum(K)=n. Real uncertainty (must be scalar) is indicated
%            by multiplying the corresponding row of K by minus one,
%            e.g., if the second uncertainty block is real then set
%            K(2)=-1.
%  Outputs:
%      r    -- an upper bound on the structured singular value of A.
%      As   -- r*(I-Ms)/(I+Ms) where Ms = Dt*(r*I-A)/(r*I)+A)/Dt',
%              Dt = Mult^0.5, and Mult = D^2 + sqrt(-1)*G/r
%              is the optimal generalized Popov multiplier
%              (see musol4.m for the definition of the matrices D and G).
%      logd -- 0.5*log(diag(Mult)).
%      x    -- the normalized eigenvector associated with the smallest
%              eigenvalue of X+X'>=0, where X=Mult*(r*I-A)/(r*I+A).

function osborne
%MATLAB Tour Partial Function Help:  rob_con
%
% OSBORNE Diagonal scaling using Osborne technique.
% 
%  [MU,ASCALED,LOGD] = OSBORNE(A)
%  [MU,ASCALED,LOGD] = OSBORNE(A,K) produces the scalar upper bound MU on
%  the structured singular value (ssv) computed via
%            mu = max(svd(diag(dosb)*A/diag(dosb)))
%  where dosb obtained by applying the Osborne scaling technique.
% 
%  Input:
%      A  -- a pxq complex matrix whose ssv is to be computed
%  Optional input:
%      K  -- an nx1 or nx2 matrix whose rows are the uncertainty block sizes
%            for which the ssv is to be evaluated; K must satisfy
%            sum(K) == [q,p].  If only the first column of K is given then the
%            uncertainty blocks are taken to be square, as if K(:,2)=K(:,1).
%  Outputs:
%      MU      -- An upper bound on the structured singular value of A
%      ASCALED -- diag(dosb)*A/diag(dosb)
%      LOGD    -- dosb=exp(LOGD)) is Osborne scaling vector
% 

function perron
%MATLAB Tour Partial Function Help:  rob_con
%
% PERRON Perron eigenvalue.
% 
%  [MU] = PERRON(A) or
%  [MU] = PERRON(A,K) produces the scalar upper bound MU on the
%  structured singular value (ssv) computed via the Perron
%  eigenvalue technique of Safonov (IEE Proc., Pt. D, Nov. '82).
% 
%  Input:
%      A  -- a pxq complex matrix whose ssv is to be computed
%  Optional input:
%      K  -- uncertainty block sizes--default is K=ones(q,2).  K is an
%            an nx1 or nx2 matrix whose rows are the uncertainty block
%            sizes for which the ssv is to be evaluated; K must satisfy
%            sum(K) == [q,p].  If only the first column of K is given then the
%            uncertainty blocks are taken to be square, as if K(:,2)=K(:,1).
%  Output:
%      MU -- An upper bound on the structured singular value of A

function psv
%MATLAB Tour Partial Function Help:  rob_con
%
% PSV Diagonal scaling via Perron eigenvector approach.
% 
%  [MU,ASCALED,LOGD] = PSV(A)
%  [MU,ASCALED,LOGD] = PSV(A,K) produces the scalar upper bound MU on
%  the structured singular value (ssv) computed via
%            mu = max(svd(diag(dperron)*A/diag(dperron)))
%  where dperron is obtained by applying the Perron eigenvector scaling
%  technique of Safonov (IEE Proc., Pt. D, Nov. '82) to the matrix A.
% 
%  Input:
%      A  -- a pxq complex matrix whose ssv is to be computed
%  Optional input:
%      K  -- an nx1 or nx2 matrix whose rows are the uncertainty block sizes
%            for which the ssv is to be evaluated; K must satisfy
%            sum(K) == [q,p].  If only the first column of K is given then the
%            uncertainty blocks are taken to be square, as if K(:,2)=K(:,1).
%  Outputs:
%      MU      -- An upper bound on the structured singular value of A
%      ASCALED -- diag(dperron)*A/diag(dperron)
%      LOGD    -- dperron=exp(LOGD)) is perron scaling vector
% 

function sigma
%MATLAB Tour Partial Function Help:  rob_con
%
% SIGMA  Singular value plot of LTI models.
% 
%    SIGMA(SYS) produces a singular value (SV) plot of the frequency 
%    response of the LTI model SYS (created with TF, ZPK, SS, or FRD).  
%    The frequency range and number of points are chosen automatically.  
%    See BODE for details on the notion of frequency in discrete time.
% 
%    SIGMA(SYS,{WMIN,WMAX})  draws the SV plot for frequencies ranging
%    between WMIN and WMAX (in radian/second).
% 
%    SIGMA(SYS,W) uses the user-supplied vector W of frequencies, in
%    radians/second, at which the frequency response is to be evaluated.  
%    See LOGSPACE to generate logarithmically spaced frequency vectors.
% 
%    SIGMA(SYS,W,TYPE) or SIGMA(SYS,[],TYPE) draws the following
%    modified SV plots depending on the value of TYPE:
%           TYPE = 1     -->     SV of  inv(SYS)
%           TYPE = 2     -->     SV of  I + SYS
%           TYPE = 3     -->     SV of  I + inv(SYS) 
%    SYS should be a square system when using this syntax.
% 
%    SIGMA(SYS1,SYS2,...,W,TYPE) draws the SV response of several LTI
%    models SYS1,SYS2,... on a single plot.  The arguments W and TYPE
%    are optional.  You can also specify a color, line style, and marker 
%    for each system, as in  sigma(sys1,'r',sys2,'y--',sys3,'gx').
%    
%    SV = SIGMA(SYS,W) and [SV,W] = SIGMA(SYS) return the singular 
%    values SV of the frequency response (along with the frequency 
%    vector W if unspecified).  No plot is drawn on the screen. 
%    The matrix SV has length(W) columns and SV(:,k) gives the
%    singular values (in descending order) at the frequency W(k).
% 
%    For details on Robust Control Toolbox syntax, type HELP RSIGMA.
% 
%    

function ssv
%MATLAB Tour Partial Function Help:  rob_con
%
% SSV Structured singular value frequency response.
% 
%  [MU,LOGD] = SSV(A,B,C,D,W) or SSV(A,B,C,D,W,K) or (A,B,C,D,W,K,OPTION)
%  or [MU,LOGD] = SSV(SS_,...), etc. produces the row-vector MU
%  containing an upper bound on the structured singular value (ssv) of
%         G(jw) = C * inv(jwI-A) * B + D
%  at each frequency in the real vector w.
%  Input:
%      A,B,C,D  -- state-space matrices of pxq transfer function matrix G(s)
%      W        -- vector of frequencies at which MU is to be computed
%  Optional inputs:
%      K  -- uncertainty block sizes--default is K=ones(q,2).  K is an
%            an nx1 or nx2 matrix whose rows are the uncertainty block
%            sizes for which the ssv is to be evaluated; K must satisfy
%            sum(K) == [q,p].If i_th uncertainty is real, set K(i,:) = [-1 -1].
%            If only the first column of K is given then the
%            uncertainty blocks are taken to be square, as if K(:,2)=K(:,1).
% 
%      OPTION  -- method for computing MU, one of the following: 'psv' (optimal
%             diagonally scaled Perron, by default), 'osborne', 'perron', and
%             'muopt' (multiplier approach for real/complex uncertainties).
%  Outputs:
%      MU      -- the bode plot of MU
%      LOGD    -- the optimal diagonal scaling D, (exp(LOGD) is the value)

function iofc
%MATLAB Tour Partial Function Help:  rob_con
%
% IOFC State-space inner-outer factorization.
% 
%  [SS_IN,SS_INP,SS_OUT] = IOFC(SS_) or
%  [AIN,BIN,CIN,DIN,AINP,BINP,CINP,DINP,AOUT,BOUT,COUT,DOUT] = IOFC(A,B,C,D)
%    produces an inner-outer factorization of a
%    m x n transfer function G: SS_ = MKSYS(A,B,C,D) (m<n)
%      such that
%                       G = |M  0| |Th |
%                                  |Thp|
%      where
%                      |Th |: square and inner
%                      |Thp|
% 
%                       M : outer factor.
% 
%      The resulting state-space quadruples are accumulated in
%      (ain,bin,...) or
% 
%             ss_in  = mksys(ain,bin,cin,din);
%             ss_inp = mksys(ainp,binp,cinp,dinp);
%             ss_out = mksys(aout,bout,cout,dout);
% 
%      The standard state-space can be recovered by "branch".
%
% Overloaded methods
%    help lti/iofc.m

function iofr
%MATLAB Tour Partial Function Help:  rob_con
%
% IOFR State-space inner-outer factorization.
% 
%  [SS_IN,SS_INP,SS_OUT] = IOFR(SS_) or
%  [AIN,BIN,CIN,DIN,AINP,BINP,CINP,DINP,AOUT,BOUT,COUT,DOUT] = IOFR(A,B,C,D)
%      produces an inner-outer factorization of a m x n transfer function
%      G: SS_ = MKSYS(A,B,C,D) (m>=n)
%      such that
%                       G = |Th Thp| |M|
%                                    |0|
%      where
%                       [Th Thp] : square and inner.
%                       M : outer factor.
% 
%      The resulting state-space quadruples are accumulated in
%      (ain,bin,...) or
% 
%             ss_in  = mksys(ain,bin,cin,din);
%             ss_inp = mksys(ainp,binp,cinp,dinp);
%             ss_out = mksys(aout,bout,cout,dout);
% 
%      The standard state-space can be recovered by "branch".
%
% Overloaded methods
%    help lti/iofr.m

function sfl
%MATLAB Tour Partial Function Help:  rob_con
%
% SFL Left spectral factorization.
% 
%  [SS_M] = SFL(SS_) or
%  [AM,BM,CM,DM] = SFL(A,B,C,D) produces a left spectral factorization
%        such that
% 
%                  M'(-s) M(s) = I - G'(-s)G(s).
% 
%                 Input data:  G(s):= SS_ = MKSYS(A,B,C,D);
%                 Output data: M(s):= SS_M = MKSYS(AM,BM,CM,DM);
% 
%   The regular state-space can be recovered by "branch".
%
% Overloaded methods
%    help lti/sfl.m

function sfr
%MATLAB Tour Partial Function Help:  rob_con
%
% SFR Right spectral factorization.
% 
%  [SS_M] = SFR(SS_) or
%  [AM,BM,CM,DM] = SFR(A,B,C,D) produces a right spectral factorization
%       via the duality of SFL such thtat
% 
%                  M(s)M'(-s) = I - G(s)G'(-s)
% 
%                 Input data:  G(s):= SS_ = MKSYS(A,B,C,D);
%                 Output data: M(s):= SS_M = MKSYS(AM,BM,CM,DM);
% 
%   The regular state-space can be recovered by "branch".
%
% Overloaded methods
%    help lti/sfr.m

function balmr
%MATLAB Tour Partial Function Help:  rob_con
%
% BALMR Square-root balanced truncation (unstable plant).
% 
%  [SS_M,TOTBND,HSV] = BALMR(SS_,MRTYPE,NO) or
%  [AM,BM,CM,DM,TOTBND,HSV] = BALMR(A,B,C,D,MRTYPE,NO) performs balanced-
%     truncation model reduction on G(s):=(a,b,c,d) such that the infinity-
%     norm of the error (Ghed(s) - G(s)) <= sum of the 2(n-k) smaller Hankel
%     singular values. For unstable G(s) the algorithm works by first
%     splitting G(s) into a sum of stable and antistable part.
% 
%    Based on the "MRTYPE" selected, you have the following options:
% 
%     1). MRTYPE = 1  --- no: order "k" of the reduced order model.
% 
%     2). MRTYPE = 2  --- find a k-th order model such that the total error
%                       is less than "no".
% 
%     3). MRTYPE = 3  --- disply all the Hankel SV and prompt for "k".
% 
%     TOTBND = Error bound, HSV = Hankel Singular Values.
%
% Overloaded methods
%    help lti/balmr.m

function bstschml
%MATLAB Tour Partial Function Help:  rob_con
%
% BSTSCHML Balanced stochastic truncation (BST) model reduction.
% 
%  [SS_H,AUG,HSV] = BSTSCHML(SS_,MRTYPE,NO,INFO) or
%  [AHED,BHED,CHED,DHED,AUG,HSV]=BSTSCHML(A,B,C,D,MRTYPE,NO,INFO) performs
%     relative error Schur model reduction on a SQUARE, STABLE G(s):=
%     (A,B,C,D). The infinity-norm of the relative error is bounded as
%                              -1               n
%             |(Gm(s)-G(s))Gm(s) |    <= 2 * ( SUM  si / (1 - si) )
%                                 inf          k+1
%     where si denotes the i-th Hankel singular value of the all-pass
%     "phase matrix" of G(s).
%     The algorithm is based on the Balanced Stochastic Truncation (BST)
%     theory with Relative Error Method (REM).
%     Based on the "MRTYPE" selected, you have the following options:
%      1). MRTYPE = 1  --- no: size "k" of the reduced order model.
%      2). MRTYPE = 2  --- find k-th order reduced model that
%                          tolerance (db) <= "no".
%      3). MRTYPE = 3  --- display all the Hankel SV of phase matrix and
%                    prompt for "k" (in this case, no need to specify "no").
%     Input variable: "info" = 'left '(default is also 'left ').
%     Output variable "aug": aug(1,1) = no. of state removed
%                            aug(1,2) = relative error bound
%     Note that if D is not full rank, an error will result.
%
% Overloaded methods
%    help lti/bstschml.m

function bstschmr
%MATLAB Tour Partial Function Help:  rob_con
%
% BSTSCHMR Balanced stochastic truncation (BST) model reduction.
% 
%  [SS_H,AUG,HSV] = BSTSCHMR(SS_,MRTYPE,NO,INFO) or
%  [AHED,BHED,CHED,DHED,AUG,HSV]=BSTSCHMR(A,B,C,D,MRTYPE,NO,INFO) performs
%     relative error Schur model reduction on a SQUARE, STABLE G(s):=
%     (A,B,C,D). The infinity-norm of the relative error is bounded as
%                -1                             n
%             |Gm (s)(Gm(s)-G(s))|    <= 2 * ( SUM  si / (1 - si) )
%                                 inf          k+1
%     where si denotes the i-th Hankel singular value of the all-pass
%     "phase matrix" of G(s).
%     The algorithm is based on the Balanced Stochastic Truncation (BST)
%     theory with Relative Error Method (REM).
%     Based on the "MRTYPE" selected, you have the following options:
%      1). MRTYPE = 1  --- no: size "k" of the reduced order model.
%      2). MRTYPE = 2  --- find k-th order reduced model that
%                          tolerance (db) <= "no".
%      3). MRTYPE = 3  --- display all the Hankel SV of phase matrix and
%                    prompt for "k" (in this case, no need to specify "no").
%     Input variable: "info" = 'left '; or 'right' (default value)
%     Output variable "aug": aug(1,1) = no. of state removed
%                            aug(1,2) = relative error bound
%     Note that if D is not full rank, an error will result.
%
% Overloaded methods
%    help lti/bstschmr.m

function imp2ss
%MATLAB Tour Partial Function Help:  rob_con
%
% IMP2SS System identification via impulse response (Kung's SVD algorithm).
% 
%  [A,B,C,D,TOTBND,SVH] = IMP2SS(Y) or
%  [A,B,C,D,TOTBND,SVH] = IMP2SS(Y,TS,NU,NY,TOL) or
%  [SS_,TOTBND,SVH] = IMP2SS(IMP_)
%  [SS_,TOTBND,SVH] = IMP2SS(IMP_,TOL) produces an approximate
%  state-space realization of a given impulse response
%                  IMP_=MKSYS(Y,TS,NU,NY,'imp')
%  using the Hankel SVD method proposed by S. Kung (Proc. Asilomar
%  Conf. on Circ. Syst. & Computers, 1978).  A continuous-time
%  realization is computed via the the inverse Tustin transform if
%  TS is positive; otherwise, a discrete-time realization is returned.
% 
%   INPUTS:  Y --- impulse response H1,...,HN stored rowwise
%                  Y=[H1(:)'; H2(:)'; H3(:)'; ...; HN(:)']
%   OPTIONAL INPUTS:
%            TS  ---  sampling interval (default  TS=0)
%            NU  ---  number of inputs  (default NU=1)
%            NY  ---  number of outputs (default NY= size(Y)*[1;0]/nu)
%            TOL ---  Hinfnorm of error bound (default TOL=0.01*S(1))
%   OUTPUTS: (A,B,C,D) discrete-time state-space realization
%            TOTBND  Infinity norm error bound  2*Sum([S(NX+1),S(NX+2),...])
%            SVH  Hankel singular values [S(1);S(2);... ]

function obalreal
%MATLAB Tour Partial Function Help:  rob_con
%
% OBALREAL Continuous order balanced realization (Moore's SVD algorithm).
% 
%  [ABAL,BBAL,CBAL,G,T] = OBALREAL(A,B,C) produces a balanced
%     realization using B. C. Moore's  algorithm.
% 
%            G : diagonal of the balanced grammian (ordered)
%            T : balancing transformation
% 

function ohklmr
%MATLAB Tour Partial Function Help:  rob_con
%
% OHKLMR Optimal Hankel norm approximation (unstable plant).
% 
%  [SS_M,TOTBND,HSV] = OHKLMR(SS_,MRTYPE,IN) or
%  [AM,BM,CM,DM,TOTBND,HSV] = OHKLMR(A,B,C,D,MRTYPE,IN) produces an optimal
%     Hankel model reduction of an given unstable plant G(s) such that
%     the inf-norm of the error (Ghed(s) - G(s)) <= sum of the k+1 to n
%     Hankel singular value of G(s) times 2. NO BALANCING IS REQUIRED.
% 
%    mrtype = 1, in = order "k" of the reduced model.
% 
%    mrtype = 2, find a reduced order model such that the total error is less
%              than "in".
% 
%    mrtype = 3, display Hankel singular values, prompt for order "k" (in this
%              case, no need to specify "in").
% 
%    TOTBND = Error bound, HSV = Hankel singular values.
%
% Overloaded methods
%    help lti/ohklmr.m

function schmr
%MATLAB Tour Partial Function Help:  rob_con
%
% SCHMR Schur balanced truncation (unstable plant).
% 
%  [SS_M,TOTBND,HSV] = SCHMR(SS_,MRTYPE,NO) or
%  [AM,BM,CM,DM,TOTBND,HSV]=SCHMR(A,B,C,D,MRTYPE,NO) performs Schur method
%     model reduction on G(s):=(a,b,c,d) such that the infinity-norm
%     of the error (Ghed(s) - G(s)) <= sum of the 2(n-k) smaller Hankel
%     singular values. For unstable G(s) the algorithm works by first
%     splitting G(s) into a sum of stable and antistable part.
% 
%    Based on the "MRTYPE" selected, you have the following options:
% 
%     1). mrtype = 1  --- no: size "k" of the reduced order model.
% 
%     2). mrtype = 2  --- find a k-th order model such that the total error
%                       is less than "no".
% 
%     3). mrtype = 3  --- disply all the Hankel SV prompt for "k" (in this
%                       case, no need to specify "no").
% 
%     TOTBND = Error bound, HSV = Hankel Singular Values.
%
% Overloaded methods
%    help lti/schmr.m

function h2lqg
%MATLAB Tour Partial Function Help:  rob_con
%
% H2LQG Continuous H2 control synthesis.
% 
%  [SS_CP,SS_CL]=H2LQG(TSS_,ARETYPE) computes the H-2 optimal controller
%     for an "augmented" plant P(s) with suitable loop-shaping weighting
%     functions such that the H2-norm of the closed-loop transfer function
%     Ty1u1(s) is minimized.
% 
%    Required Input data:
%      Augmented plant P(s): TSS_ = MKSYS(A,B1,B2,C1,C2,D11,D12,D21,D22,'tss')
% 
%    Optional Input:
%      Riccati solver:    aretype = 'eigen' or 'Schur' (default = 'eigen')
% 
%    Output data:
%      Controller F(s):     SS_CP = MKSYS(acp,bcp,ccp,dcp)
%      CLTF of Ty1u1(s):    SS_CL = MKSYS(acl,bcl,ccl,dcl)
% 
%    Caveat:  Note that D11 matrix must be zero or the problem is ill-posed;
%    if D11 is nonzero, H2LQG computes the controller as if it were.
%
% Overloaded methods
%    help lti/h2lqg.m

function dh2lqg
%MATLAB Tour Partial Function Help:  rob_con
%
% DH2LQG Discrete H2 control synthesis.
% 
%  [SS_CP,SS_CL] = DH2LQG(TSS_,ARETYPE) computes the discrete H2 controller
%     for an "augmented" plant P(z) with suitable loop-shaping weighting
%     functions such that the H2-norm of the closed-loop transfer function
%     Ty1u1(z) is minimized.  
% 
%    Required Input data:
%      Augmented plant P(z): TSS_ = MKSYS(A,B1,B2,C1,C2,D11,D12,D21,D22,'tss')
% 
%    Optional Input:
%      Riccati solver:    aretype = 'eigen' or 'Schur' (default = 'eigen')
% 
%    Output data:
%      Controller F(z):     SS_CP = MKSYS(acp,bcp,ccp,dcp)
%      CLTF of Ty1u1(z):    SS_CL = MKSYS(acl,bcl,ccl,dcl)
% 
%   Notes: - DH2LQG computes the optimal H2 controller under the constraint  
%            that it must be strictly causal; i.e., the controller's
%            D-matrix is constrained to be zero so that the current
%            value of the control u2(i) depends only on prior values
%            of the measurement signal {y(i-1), y(i-2),y(i-3),etc.}. 
%          - Unlike the continuous H2 theory in which the plant's D11
%            matrix must be zero for the H2 problem to be well-posed, the
%            discrete H2 theory imposes no such requirement. The optimal
%            discrete H2 controller SS_CP does not even depend on D11.

function hinf
%MATLAB Tour Partial Function Help:  rob_con
%
%      << 4-block Optimal H-inf Controller (all solution formulae) >>
%                (Safonov, Limebeer and Chiang, 1989 IJC)
% 
%    [SS_CP,SS_CL,HINFO,TSS_K]=HINF(TSS_P,SS_U,VERBOSE) computes the
%    H-infinity controller F(s) and the controller parameterization K(s)
%    using the "loop-shifting formulae". Given any stable U(s) with
%    || U ||_inf <=1, F(s) is formed by wrapping feedback U(s) around K(s).
% 
%    Required inputs --
%       Augmented plant P(s): TSS_P=MKSYS(A,B1,B2,C1,C2,D11,D12,D21,D22)
% 
%    Optional inputs --
%           Stable contraction U(s): SS_U=MKSYS(AU,BU,CU,DU) (default: U=0)
%           VERBOSE:  if  1,  a verbose display results (default),
%                     if  0, HINF operates silently
% 
%    Output data: Controller F(s):        SS_CP=MKSYS(ACP,BCP,CCP,DCP)
%                 Closed-Loop Ty1u1(s):   SS_CL=MKSYS(ACL,BCL,CCL,DCL)
%                 hinfo = (hinflag,RHP_cl,lamps_max) ("hinflag":existence flag)
%                 All-solutions controller parameterization K(s):
%                      TSS_K=MKSYS(A,BK1,BK2,CK1,CK2,DK11,DK12,DK21,DK22)
%
% Overloaded methods
%    help lti/hinf.m

function dhinf
%MATLAB Tour Partial Function Help:  rob_con
%
% DHINF Discrete H-Infinity control synthesis (bilinear transform version).
% 
%      << Discrete 4-block Optimal H-inf Controller (all solution formulae) >>
%        (via Bilinear Transform, Safonov, Limebeer and Chiang, 1989 IJC)
% 
%    [SS_CP,SS_CL,HINFO,TSS_K]=DHINF(TSS_P,SS_U,VERBOSE) computes the
%    discrete H-inf controller F(z) and the controller parameterization K(z)
%    using the "loop-shifting formulae" of Safonov, Limebeer and Chiang
%    (IJC, 1989) and Bilinear Transform.  Given any stable U(z) having inf-norm
%    not greater than one, F(z) is formed by feeding back U(z) around K(z).
%    Required inputs --
%       Augmented plant P(z): TSS_P=MKSYS(A,B1,B2,C1,C2,D11,D12,D21,D22)
%    Optional inputs --
%           Stable contraction U(z): SS_U=MKSYS(AU,BU,CU,DU) (default: U=0)
%           VERBOSE:  if  1,  a verbose display results (default),
%                     if  0, HINF operates silently
%    Output data: Controller F(z):        SS_CP=MKSYS(ACP,BCP,CCP,DCP)
%                 Closed-Loop Ty1u1(z):   SS_CL=MKSYS(ACL,BCL,CCL,DCL)
%                  hinfo = (hinflag,RHP_cl,lamps_max)
%                 "hinflag" is the H-Infinity existence flag in ASCII
%                 All-solutions controller parameterization K(z):
%                      TSS_K=MKSYS(A,BK1,BK2,CK1,CK2,DK11,DK12,DK21,DK22)
%    This file can also used as a script file by typing DHINF with input
%    variables (A,B1,B2,C1,C2,D11,D12,D21,D22) ready in the main workspace
%    in which case the variables (ss_cp,ss_cl,acp,bcp,ccp,dcp,acl,bcl,ccl,
%    dcl,hinfo) are returned in the main workspace.

function hinfopt
%MATLAB Tour Partial Function Help:  rob_con
%
% HINFOPT H-Infinity control synthesis via Gamma iteration.
% 
%  [GAM_OPT,SS_CP,SS_CL] = HINFOPT(TSS_,GAMIND,AUX) or
%  [GAM_OPT,ACP,BCP,CCP,DCP,ACL,BCL,CCL,DCL] = HINFOPT(A,B1,..,GAMIND,AUX)
%   does H-inf Gamma-Iteration to compute optimal H-Infinity control
%   laws for a given system Tcl:(TSS_) via the improved Loop-Shifting
%   two-Riccati formulae. "Gam_opt" is the optimal "gamma" for which
% 
%                    || gamma * Tcl(gamind,:)   ||
%                    ||                         ||     <= 1
%                    ||         Tcl(otherind,:) || inf
%   where
%        Tcl(gamind,:) contains the rows to be weighted by "gamma",
%        Tcl(otherind,:) contains the other rows of Tcl.
%   Inputs:  Tcl: TSS_ = mksys(A,B1,B2,C1,C2,D11,D12,D21,D22); 
%        Optional Inputs:
%            gamind: the index of the outputs to be scaled by gamma
%                    (default: all output channels)
%            aux   : [tol, maxgam, mingam] (default: [0.01 1 0])
%                    tol   : tolerance for stopping the iteration
%                    maxgam: initial guess for maximum "gam_opt"
%                    mingam: initial guess for minimum "gam_opt"
%   Outputs: gam_opt (optimal gamma)
%         H-Inf optimal controller:   ss_cp = mksys(acp,bcp,ccp,dcp)
%         gamma-weighted closed-loop: ss_cl = mksys(acl,bcl,ccl,dcl)
%
% Overloaded methods
%    help lti/hinfopt.m

function normh2
%MATLAB Tour Partial Function Help:  rob_con
%
% NORMH2 Continuous H2 norm.
% 
%  [NMH2] = NORMH2(A,B,C,D) or
%  [NMH2] = NORMH2(SS_) computes the H2 norm of the given state-space
%     realization. If the system not strictly proper, INF is returned.
%     Otherwise, the H2 norm is computed as
% 
%             NMH2 = trace[CPC']^0.5 = trace[B'QB]^0.5
% 
%     where P is the controllability grammian, and Q is the observability
%     grammian.

function normhinf
%MATLAB Tour Partial Function Help:  rob_con
%
% NORMHINF Continuous H-Infinity norm.
% 
%  [NMHINF] = NORMHINF(A,B,C,D,tol) or
%  [NMHINF] = NORMHINF(SS_,tol) computes the HINF norm of the given
%     state-space realization. Implemented here is a binary search
%     algorithm of imaginary axis eigenvalue(s) of the Hamiltonian
% 
%                         -1           -1
%        H(gam) = | A + BR  D'C     -BR  B'        |
%                 |       -1                -1     |
%                 |C'(I+DR  D')C    -(A + BR  D'C)'|
% 
%     where R = gam^2 I - D'D > 0. HINF norm equals to "gam" when H
%     has imaginary axis eigenvalue(s).
% 
%     Inital guesses of the HINF norm upper/lower bounds are
% 
%        Upper Bound: max_sigma(D) + 2*sum(Hankel SV(G))
%        Lower Bound: max{max_sigma(D), max_Hankel SV(G)}.
% 
%     The search algorithm stops when two adjacent "gam's" have relative
%     error less than "tol". If no "tol" provided, tol = 0.001.

function lqg
%MATLAB Tour Partial Function Help:  rob_con
%
% LQG Continuous linear-quadratic-Gaussian control synthesis.
% 
%  [SS_F] = LQG(SS_,W,V) or
%  [AF,BF,CF,DF] = LQG(A,B,C,D,W,V) computes Linear-Quadratic-Gaussian
%     optimal controller via the "separation principle", such that the
%     cost function
%                      T
%     J    = lim E{ int   |x' u'| W |x| dt} , W = |Q  Nc|, is minimized
%      LQG   T-->inf   0            |u|           |Nc' R|
%     and subject to the plant
%                        dx/dt = Ax + Bu + xi
%                            y = Cx + Du + th
% 
%     where the white noises {xi} and {th} have the cross-correlation
%     function with intensity V, i.e.
% 
%            E{|xi| |xi th|'} = V delta(t-tau), V =  |Xi  Nf|.
%              |th|                                  |Nf' Th|
% 
%     The LQG optimal controller F(s) is returned in SS_F or (af,bf,cf,df).
%     The standard state-space can be recovered by "branch".

function ltru
%MATLAB Tour Partial Function Help:  rob_con
%
% LTRU Continuous LQG/LTR control synthesis (at plant input).
% 
%  [ss_f,svl] = ltru(ss_,Kc,Xi,Th,r,w,svk) or
%  [af,bf,cf,df,svl] = ltru(A,B,C,D,Kc,Xi,Th,r,w,svk) produces
%     LQG/LTR at inputs of the plant, such that the LQG loop TF
%     will converge to LQSF's loop TF as the plant noise goes to INF:
%                         -1                  -1
%      GKc(Is-A+B*Kc+Kf*C) Kf -------> Kc(Is-A) B   (as r --> INF)
% 
%   Inputs: (A,B,C,D) -- system, or ss_ -- system matrix (built by "mksys")
%           Kc -- LQSF gain
%   (optional) svk(MIMO) -- SV of (Kc inv(Is-A)B)
%   (optional) svk(SISO) -- [re im;re(reverse order) -im(reverse order)]
%                           of complete Nyquist plot
%           w --- frequency points
%           Xi -- plant noise intensity, Th -- sensor noise intensity
%           r --- a row vector containing a set of recovery gains
%                (nr: length of r). At each iteration, Xi <-- Xi + r*B*B';
%   Outputs: svl -- singular value plots of all the recovery points
%            svl(SISO) -- Nyquist loci svl = [re(1:nr) im(1:nr)]
%            final state-space controller (af,bf,cf,df).
%
% Overloaded methods
%    help lti/ltru.m

function ltry
%MATLAB Tour Partial Function Help:  rob_con
%
% LTRY Continuous LQG/LTR control synthesis (at plant output).
% 
%  [ss_f,svl] = ltry(ss_,Kf,Q,R,q,w,svk) or
%  [af,bf,cf,df,svl] = ltry(A,B,C,D,Kf,Q,R,q,w,svk) produces
%     LQG/LTR at inputs of the plant, such that the LQG loop TF
%     will converge to KBF's loop TF as the state wt. goes to INF:
%                         -1                  -1
%      GKc(Is-A+B*Kc+Kf*C) Kf -------> C(Is-A) Kf   (as q ---> INF)
% 
%   Inputs: (A,B,C,D) -- system, or ss_ -- system matrix (built by "mksys")
%           Kf -- Kalman filter gain
%   (optional) svk(MIMO) -- SV of (C inv(Is-A)Kf)
%   (optional) svk(SISO) -- [re im;re(reverse order) -im(reverse order)]
%                           of the complete Nyquist plot
%           w -- frequency points
%           Q -- state weighting, R -- control weighting
%           q -- a row vector containing a set of recovery gains
%                (nq: length of q). At each iteration, Q <-- Q + q*C'*C;
%   Outputs: svl -- singular value plots of all the recovery points
%            svl(SISO) -- Nyquist loci svl = [re(1:nq) im(1:nq)]
%            final state-space controller (af,bf,cf,df)
% 
%
% Overloaded methods
%    help lti/ltry.m

function youla
%MATLAB Tour Partial Function Help:  rob_con
%
% YOULA Youla parameterization.
% 
%          YOULA produces a state space realization of T11, T12, T21,
%          T12p, T21p via Youla lemma - parameterization of
%          stabilizing controller.
%          Program inputs : argumented plant (A,B1,B2,C1,C2,D11,
%                           D12,D21,D22).
%          Program outputs: state-space of T11, T12, T12p, T21, T21p
%                           full-state LQR: kx,x,f
%                           observer LQR  : ky,y,h

function accdemo
%MATLAB Tour Partial Function Help:  rob_con
%
% ACCDEMO Demo of 1990 ACC benchmark problem.
% 
%  ---------------------------------------------------------------
%   ACCDEMO.M is a script file that demonstrates the designs of
%      1990 ACC benchmark problem.
%  ---------------------------------------------------------------
% 

function dintdemo
%MATLAB Tour Partial Function Help:  rob_con
%
% DINTDEMO Demo of H-Infinity design of double integrator plant.
% 

function hinfdemo
%MATLAB Tour Partial Function Help:  rob_con
%
% HINFDEMO H-2 & H-inf Optimal Control Synthesis Demonstration.
% 

function ltrdemo
%MATLAB Tour Partial Function Help:  rob_con
%
% LTRDEMO Demo of LQG/LTR optimal control synthesis.
% 

function mudemo
%MATLAB Tour Partial Function Help:  rob_con
%
% MUDEMO Demo of MU-synthesis on 1990 ACC benchmark problem.
% 
%  ---------------------------------------------------------------
%   MUDEMO.M is a script file that demonstrates the design of
%      1990 ACC benchmark problem using MU-SYNTHESIS.
%  ---------------------------------------------------------------

function mudemo1
%MATLAB Tour Partial Function Help:  rob_con
%
% MUDEMO1 Demo of MU-synthesis on a simple problem.
% 
%  

function mrdemo
%MATLAB Tour Partial Function Help:  rob_con
%
% MRDEMO Demo of model reduction techniques.
% 

function rctdemo
%MATLAB Tour Partial Function Help:  rob_con
%
% RCTDEMO Set up ROBUST CONTROL demos for The MATLAB Expo.

function musldemo
%MATLAB Tour Partial Function Help:  rob_con
%
% MUSLDEMO Musol4 demo
% 

