Professional Documents
Culture Documents
Toolbox
0
by the respective matrix. (Assumed to
0 0.05 0.1 0.15 0.2 0.25
be the identity if left out.)
•‘AutoSimplify’ – parameter to set the
Sampled F(2,3) - F(2,3).NominalValue
10
Input: EX:
N = udyn('N',[2 3])
•‘Name’ – Variable name for output
Uncertain Dynamic System:
•Iosize - input/output dimension Name N, size 2x3
specification. [Input,Output] size(N)
ans =
2 3
Output: get(N)
Name: 'N'
•N - an unstructured uncertain
NominalValue: [2x3 double]
dynamic system class
AutoSimplify: 'basic'
30
•Name – variable name
20
•Iosize – the size of [input, output]
10
-10
magnitude of the response.
-20 •‘PositiveReal’ – lower bound on the
-30 real part
•‘Bound’ – Specifies the actual bound
-40
-10 0 10 20 30 40 50 60 70 80
Real Axis
Parameters Include:
EX:
•A,B,C,D – umat or other uncertain state p1 = ureal('p1',5,'Range',[2 6]);
space parameters to describe the p2 =
system. ureal('p2',3,'Plusminus',0.4);
•Ts – sample time for a discrete time A = [-p1 0;p2 -p1];
state space object. B = [0;p2];
C = [1 1];
•RefSys – if a refrence uss is given, the usys = uss(A,B,C,0);
parameters of that object are included.
•Note: if only one matrix is include, the
function assumes that it represents D
and a static gain matrix.
-10
Magnitude (dB)
-20
-30
Parameters Include:
•Name – uncertain system
-40
45
0
Phase (deg)
-45
-135
-180
model.
-2 -1 0 1 2
10 10 10 10 10
Frequency (rad/sec)
EX:
p1 = ureal('p1',5,'Range',[2 6]); •‘Units’ – specify units:
p2 = ureal('p2',3,'Plusminus',0.4);
p3 = ultidyn('p3',[1 1]);
Wt = makeweight(.15,30,10);
•‘rad/s’ – default
A = [-p1 0;p2 -p1];
B = [0;p2]; •‘hz’
C = [1 1];
usys = uss(A,B,C,0)*(1+Wt*p3);
usysfrd = ufrd(usys,logspace(-2,2,60));
bode(usysfrd,'r',usysfrd.NominalValue,'b+')
Example
The following statement creates the umat uncertain object x1 of size 2-
by-3. Note that your result can differ because a random seed is used
x1 = randumat(2,3)
UMAT: 2 Rows, 3 Columns
ROQAW: complex, nominal = 9.92+4.84i, radius = 0.568, 1
occurrence
UEPDY: real, nominal = -5.81, variability = [-1.98681
0.133993], 3 occurrences
VVNHL: complex, nominal = 5.64-6.13i, radius = 1.99, 2
occurrences
s1 = randuss(5,2,3)
USS: 5 States, 2 Outputs, 3 Inputs, Continuous System
CTPQV: 1x1 LTI, max. gain = 2.2, 1 occurrence
IGDHN: real, nominal = -4.03, variability = [-3.74667 22.7816]%, 1 occurrence
MLGCD: complex, nominal = 8.36+3.09i, +/- 7.07%, 1 occurrence
OEDJK: complex, nominal = -0.346-0.296i, radius = 0.895, 1 occurrence
p1 = ureal('p1',3,'Range',[2 5]);
L = [2 p1];
L(1)
UMAT: 1 Rows, 1 Columns
L(2)
UMAT: 1 Rows, 1 Columns
p1: real, nominal = 3, range = [2 5], 1 occurrence
simplify(L(1))
ans =
2
simplify(L(2))
Uncertain Real Parameter: Name p1, NominalValue 3, Range [2 5]
Example
A = ureal('A',5);
Asample = usample(A,500);
size(A)
ans =
1 1
size(Asample)
ans =
1 1 500
class(Asample)
ans =
double
hist(Asample(:))
Input:
EX:
• Usys - a continuous-time p2=ureal('p2',-17,'Range',[-19 -11]);
uncertain system p1=ureal('p1',3.2,'Percentage',0.43);
A = [-12 p1;.001 p2];
• Wc - the critical frequency for the B = [120 -809;503 24];
bilinear prewarp transformation C = [.034 .0076; .00019 2];
usys = ss(A,B,C,zeros(2,2))
from continuous time to discrete
time. (Default is 1) USS: 2 States, 2 Outputs, 2 Inputs, Continuous System
p1: real, nominal = 3.2, variability = [-0.43 0.43]%, 1 occurrence
Output: p2: real, nominal = -17, range = [-19 -11], 1 occurrence
Example
Consider usys1 and usys2, two single-input/single-output uss
models:
You can stack along the first dimension to produce a 2-by-1 uss array.
stack(1,P1,P1)
USS: 2 States, 1 Output, 1 Input, Continuous System [array, 2 x 1]
wn: real, nominal = 0.5, range = [0.3 0.7], 3 occurrences
zeta: real, nominal = 1, range = [0.4 4], 1 occurrence
When the plant modeling uncertainty is not too big, you can design high-gain,
high-performance feedback controllers. High loop gains significantly larger than 1
in magnitude can attenuate the effects of plant model uncertainty and reduce the
overall sensitivity of the system to plant noise.
But if your plant model uncertainty is so large that you do not even know the sign
of your plant gain, then you cannot use large feedback gains without the risk that
the system will become unstable. Thus, plant model uncertainty can be a
fundamental limiting factor in determining what can be achieved with feedback.
The Small Gain Theorem asserts that the overall system gain must therefore be
kept below 1 to assure stability.
0 -90
K = 1; 10
-5
10
0
10
-2
10
0 2
10
EX:
opt = robopt
Property Object Values:
Display: 'off'
Sensitivity: 'on'
VaryUncertainty: 25
Mussv: 'sm9'
Default: [1x1 struct]
Meaning: [1x1 struct]
[maxnormMi] = wcnorm(Mi)
maxnormMi =
•Wcu - a structure that includes values of
LowerBound: 2.5963
uncertain elements and maximizes the UpperBound: 2.5979
matrix norm
EX:
a = [0 10;-10 0];
b = eye(2);
c = [1 8;-10 1];
d = zeros(2,2);
G = ss(a,b,c,d);
Output Structure Fields: K = [1 -2;0 1]; ingain1 = ureal('ingain1',1,'Range',[0.97 1.06]);
b = [ingain1 0;0 1];
•Wcmargi – contains gain margin Gunc = ss(a,b,c,d);
bound, phase margin in degrees, unmod = ultidyn('unmod',[2 2],'Bound',0.08);
Gmod = (eye(2)+unmod)*Gunc;
frequency associate with worst case, Gmodg = ufrd(Gmod,logspace(-1,3,60));
and a structure containing the [wcmi,wcmo] = wcmargin(Gmodg,K);
sensitivity to all uncertain elements.
wcmi(1) =
•Wcmargo – same structure as GainMargin: [0.3613 2.7681]
PhaseMargin: [-50.2745 50.2745]
wcmargi but gives single loop values Frequency: 0.1000
for each. Sensitivity: [1x1 struct]
function -10
Magnitude (dB)
-15
-30
Nominal Sensitivity
1
10
• The parameter trajectory and input signals are specified by two time
functions p=traj(t) and u=ut(t)
• The affine system pds is specified with psys but can also use the
polytopic representation of such systems as returned by aff2pol(pds) or
hinfgs
• The final time and initial state vector can be reset through tf and xi
• options gives access to the parameters controlling the ODE integration
20
Singular Values (dB)
-20
-40
-60
Input:
-80
-4 -2 0 2 4 6
Input Parameters:
•P – lmi object such as ss or tf.
•R – [z2, y, u]
•Obj – [gamma, v, alpha, beta]
•Region – identifies the pole placement
region. Default is the open LHP.
Output Parameters:
•Dkbnd – set bound on norm of controller •Gopt - guaranteed Hinf performance
feed through matrix DK. •H2opt – guaranteed H2 performance
•Tol – tolerance for the trade-off parameter •K – Controller K(s) coefficients
•R,S – optimal values of the LMI objects.
Input Parameters:
•P – partitioned system matrix
•Nmeas – row size of C2 Where:
•NCon – column size of B2 Plant Partitioning:
Output parameters: •B1 – Inputs are disturbances
•B2 – Inputs are control signals
•K – H infinity controller coefficients •C1 – Outputs are errors to be minimized
•Gam – H infinity norm cost for the system •C2 – Outputs are inputs to control K
April 2006 Nathan Sorensen Kedrick Black 93
[K,CL,GAM,INFO]=
loopsyn(G,Gd,RANGE)
Loopsyn() is an H – infinity optimal way for loopshaping controller
synthisis.
Singular Values
Input Parameters:
50
40 •G – LTI plant
30
20
•Gd – desired loop shape
Singular Values (dB)
10
•Range – [Wmin,Wmax] desired loop
0
shaping frequency range. (10*Wmin
-10
<= Wmax)
-20
-30
Output Parameters:
-40
10
-1 0
10
1
10
2
10 •K – Controller Coefficient vector
Frequency (rad/sec)
Input Parameters:
•G – LTI system
•W1,W2,W3 – Weighting matricies
associated with S(s), R(s) and T(s)
20
-100
•K – controller coefficient vector
-2 -1 0 1 2
10 10 10 10 10
-50 0
Input: -100 -50
180 0
•Fc – cutoff frequency of the filter 90 -45
-90 -360
•'rc‘ - Series of resistor/ capacitor 10
-2
10
0 2
10 10
0 2
10
Frequency (rad/sec) Frequency (rad/sec)
filters
EX:
•Psbndr - the magnitude of the passband butw = mkfilter(2,4,'butterw');
cheb = mkfilter(4,4,'cheby',0.5);
Output: rc = mkfilter(1,4,'rc');
•Sys – Designed filter bode(butw,'-',cheb,'--',rc,'-.')
April 2006 Nathan Sorensen Kedrick Black 98
Mu-synthesis
Mu-synthesis functions enable the synthesis of robust optimal
controllers. Approximation tools for this type of design are shown
below:
1. Cmsclsyn() approximately solves the constant-matrix, upper bound µ-
synthesis problem.
2. Dksyn() synthesizes a robust controller via D-K iteration which is an
approximation to µ-synthesis control design.
3. Dkitopt() creates a dkitopt object called options with specific values
assigned to certain properties.
4. Drawmag() interactively uses the mouse in the plot window to create pts
and sysout, which approximately fits the frequency response (magnitude)
in pts.
5. Fitfrd() fits D-scaling frequency response data with state-space model.
6. Fitmagfrd() fits frequency response magnitude data with a stable,
minimum-phase state-space model.
April 2006 Nathan Sorensen Kedrick Black 99
[qopt,bnd] =
cmsclsyn(R,U,V,BlockStructure);
Cmsclsyn() approximately solves the constant-matrix, upper bound µ-
synthesis problem by minimization,
Input: Output:
•R,U,V – Constant matrices of •Qopt - the optimum value of Q
appropriate structure
•Bnd - the upper bound of
•BlockStructure – a matrix mussv(R+U*Q*V,BLK)
specifying the perturbation
blockstructure as defined for
mussv.
Input:
•P – Partitioned plant matrix EX:
•Nmeas – row size of the C2 matrix G = tf(1,[1 -1]);
Wu = 0.25*tf([1/2 1],[1/32 1]);
•Ncon – column size of the B2 matrix InputUnc = ultidyn('InputUnc',[1 1]);
Output: Gpert = G*(1+InputUnc*Wu);
•K – synthesized controller coefficients Wp = tf([1/4 0.6],[1 0.006]);
P = [Wp; 1 ]*[1 Gpert];
•Clp – Closed loop system [K,clp,bnd1] = dksyn(P,1,1);
•Bnd – robust performance bounds on P = [Wp; 1 ]*[1 Gpert];
the closed loop system [K,clp,bnd2] = dksyn(P,1,1);
bnd1 =0.6768
April 2006 Nathan Sorensen Kedrick Black bnd2 =0.6768 101
options =
dkitopt('name1',value1,'name2',value2,...)
Dkitopt() creates a dkitopt object called options with specific values
assigned to certain properties.
Example
sys = tf([1 2 2],[1 2.5 1.5])*tf(1,[1 0.1]);
sys = sys*tf([1 3.75 3.5],[1 2.5 13]);
omeg = logspace(-1,1);
sysg = frd(sys,omeg);
bode(sysg,'r-');
b1 = fitfrd(sysg,1);
b3 = fitfrd(sysg,3);
b1g = frd(b1,omeg);
b3g = frd(b3,omeg);
bode(sysg,'r-',b1g,'k:',b3g,'b-.')
Input: Output:
kd = c2d(k,0.75,'zoh');
[gu,gl] = sdhinfnorm([1; 1]*p*[1 1],-kd);
[gu gl]
ans = 3.7908 3.7929
kd = c2d(k,0.2,'zoh');
[gu,gl] = sdhinfnorm([1; 1]*p*[1 1],-kd);
[gu gl]
ans = 1.0044 1.0049
Input:
•P - a continuous-time LTI system
•K – a discrete-time LTI system with a
specified sampling time
•W,T – input forcing functions
•Tf – simulation end time
•X0 - initial state vector of p, at time t(1)
•Z0 - initial state vector of k, at time t(1)
•Int - the continuous-time integration
step size
April 2006 Nathan Sorensen Kedrick Black 109
Sdlsim() example cont:
Step response: disturbance (dashed) & output (solid)
1.4
1.2
0.8
EX: 0.6
T = 1.0/20; 0.2
C = ss([-1.5 T/4; -2/T -.5],[ .5 2;1/T
0
1/T],...
-0.2
[-1/T^2 -1.5/T], [1/T^2 0],T); 0 0.1 0.2 0.3 0.4 0.5 0.6
Time: seconds
0.7 0.8 0.9 1
Pd = c2d(P,T,'zoh');
EX cont:
systemnames = 'Pd C';
M2 = [0,1,1;1,0,0;0,1,1]*blkdiag(1,1,P);
inputvar = '[ref]';
t = [0:.001:1]';
outputvar = '[Pd]';
dist = 0.1*sin(41*t);
input_to_Pd = '[C]';
u = ones(size(t));
input_to_C = '[ref ; Pd]';
[y3,meas,act] = sdlsim(M2,C,[u dist],t,1);
sysoutname = 'dclp';
plot(y3{:},'-',t,dist,'b--',t,u,'g-.')
cleanupsysic = 'yes';
xlabel('Time: seconds')
sysic;
title('Step response: disturbance (dashed) & output
(solid)')
EX:
P=rss(2,4,5); P=mktito(P,2,2);
disp(P.OutputGroup);
disp(P.InputGroup); Plant Partitioning:
Y1: [1 2] B1 – Inputs are disturbances
Y2: [3 4] B2 – Inputs are control signals
C1 – Outputs are errors to be minimized
U1: [1 2 3]
U2: [4 5] C2 – Outputs are inputs to control K
April 2006 Nathan Sorensen Kedrick Black 115
[G,T] = sectf(F,SECF,SECG)
• State-space sector bilinear transformation
• computes a linear fractional transform T such that the system lft(F,K) is in
sector SECF if and only if the system lft(G,K) is in sector SECG where
G=lft(T,F,NU,NY) where NU and NY are the dimensions of uT2 and yT2,
respectively
Note that the constraints A(x) > 0 and A(x) < B(x) are special cases of (1-1)
since they can be rewritten as -A(x) < 0 and A(x) - B(x) < 0, respectively.
This process creates the so-called internal representation of the LMI system. This
computer description of the problem is used by the LMI solvers and in all
subsequent manipulations of the LMI system. It is stored as a single vector called
LMISYS.
There are two ways of generating the internal description of a given LMI system:
1. by a sequence of lmivar/lmiterm commands that build it incrementally
2. via the LMI Editor lmiedit where LMIs can be specified directly as symbolic matrix
expressions. Though somewhat less flexible and powerful than the command-
based description, the LMI Editor is more straightforward to use, hence
particularly well-suited for beginners.
Two Uses:
1. setlmis([ ]) - used to initialize an internal representation for an lmi
to be followed by lmivar and lmiterm.
2. setlmis(lmi0) – adds to an existing lmi where lmi0 is the internal
representation of a lmi. (Subsequent lmivar and lmiterm
commands will then add new variables and terms to the initial
LMI system lmi0.)
EX:
lmiterm([1 1 1 X2],2*A,A') % 2*A*X2*A'
lmiterm([1 1 1 x3],-1,E) % -x3*E
lmiterm([1 1 1 0],D*D') % D*D'
lmiterm([1 2 1 -X1],1,B) % X1'*B
lmiterm([1 2 2 0],-1) % -I
Purpose:
To give individual names to lmi’s so that they
can be easily distinguished in code.
Use:
When parts of LMI’s are deleted from a LMI,
identifiers help to identify the remaining parts
of the system.
EX:
lmiinfo(lmis)
LMI ORACLE
-------
This is a system of 1 LMI with 3 variable matrices
Do you want information on
(v) matrix variables (l) LMIs (q) quit?> v
Which variable matrix (enter its index k between 1 and 3) ? 1
X1 is a 2x2 symmetric block diagonal matrix
its (1,1)-block is a full block of size 2
-------
April 2006 Nathan Sorensen Kedrick Black 131
LMI Info Example Cont:
This is a system of 1 LMI with 3 variable matrices
Do you want information on
(v) matrix variables (l) LMIs (q) quit?> l
Which LMI (enter its number k between 1 and 1) ? 1
This LMI is of the form
0 < R(x)
where the inner factor(s) has 2 diagonal block(s)
Do you want info on the right inner factor ?
(w) whole factor (b) only one block
(o) other LMI (t) back to top level?> w
Info about the right inner factor
block (1,1) : I + a1*X1 + A2*X2*B2 + B2'*X2'*A2'
block (2,1) : A3*X1
block (2,2) : x3*A4
(w) whole factor (b) only one block
(o) other LMI (t) back to top level
EX:
Input: For an LMI system LMIs with
•Lmisys – System of LMIs two matrix variables X and Y
such that X is symmetric
block diagonal with one 2-
Output: by-2 full block, and one 2-by-
2 scalar block Y is 2-by-3
•Ndec - the length of the vector rectangular,
of decision variables. the number of decision
variables is:
ndec = decnbr(LMIs)
ndec = 10
April 2006 Nathan Sorensen Kedrick Black 135
valX = dec2mat(lmisys,decvars,X)
Dec2mat() is a function that, given values of the decision variables,
derives the corresponding values of the matrix variables.
Input:
Output:
•Lmisys – System of LMIs
•Decvars - the vector of decision •ValX – Values of the matrix variable
variables with the identifier X.
Input: EX:
•Lmisys – System of LMIs Given –
•X1,..,Xn – system matrix variables
evaluated at x1,…,xn
Output: decv =
mat2dec(lmisys,X0,Y0)
•Decvec - vector of decision variables
decv‘ = [ 1 3 -1 5 1 2 3
4 5 6]
April 2006 Nathan Sorensen Kedrick Black 137
decX = decinfo(lmisys,X)
DecX() expresses the entries of a matrix variable X in terms of the
decision variables x1, . . ., xN.
EX:
setlmis([])
Input:
X = lmivar(1,[3 0])
Y = lmivar(2,[2 1]) •Lmisys – System of LMIs
:
: •X - each entry of X is either a hard
lmis = getlmis zero, some decision variable xn, or its
dX = decinfo(lmis,X) opposite –xn
dX =
1 0 0
0 1 0
Output:
0 0 1
•DecX - clarifies the structure of X as
dY = decinfo(lmis,Y) well as its entry-wise dependence on
dY = x1, . . ., xN
2
3
April 2006 Nathan Sorensen Kedrick Black 138
LMI Solvers
LMI solvers are provided for the following three generic optimization
problems
•Feasibility problem
Find x RN (or equivalently matrices X1, . . . , XK with prescribed structure) that
satisfies the LMI system
A(x) < B(x)
The corresponding solver is called feasp. Minimization of a linear objective under
LMI constraints
Input:
• Lmisys – LMI system to solve
• Options – zeros set to default parameters
1 – not used
2 - sets the maximum number of
iterations (100 by default) Output:
3 - resets the feasibility radius • Tmin – Constraints are feasible
4 - helps speed up termination if tmin<=0 and strictly feasible if
tmin<0
5 – a 1 turns off the trace of execution of
the optimization procedure. 0 is on. • Xfeas - a solution in terms of the
• Target - sets a target value for tmin decision variables
April 2006 Nathan Sorensen Kedrick Black 140
Feasp() Example
EX:
setlmis([])
p = lmivar(1,[2 1])
[tmin,xfeas] = feasp(lmis)
tmin = -3.1363
P = dec2mat(lmis,xfeas,p)
Input: Output:
•Lmisys – system of LMIs •V1,…,Vk – value of these variables
when the n-th decision variable is set to
•N – the number of the nth decision one and all others to zero.
variable
•X1,…,Xk – identifiers of the matrix
variables involved in this objective
Input: Output:
•Lhs, Rhs - The left- and right-hand
•Evalsys - the output of evallmi sides of the n-th LMI constant
•N – the number of lmis matrices
1. Dellmi() deletes the nth LMI from the system of LMIs described in
lmisys. The updated system is returned in newsys.
2. Delmvar() removes the matrix variable X with identifier X from the list of
variables defined in lmisys.
3. Setmvar() sets the matrix variable X with identifier X to the value Xval.
EX: Input:
Consider the LMI: •Lmisys – system of LMIs
•X – name of LMI to be deleted
Ouput:
lmisys = delmvar(lmisys,X) •Newsys – system of LMIs after
Gives the system: the LMI X has been deleted
for some fixed real matrices M and L = LT. This class of regions
encompasses half planes, strips, conic sectors, disks, ellipses, and
any intersection of the above.
dmplot(1.414)
1. Rcond() creates an estimate for the reciprocal of the condition of the frd object
x in the 1-norm .
2. Schur() applies the schur command to frd objects.
3. Diag(x) puts x on the main diagonal of a matrix.
4. Genphase() fit SISO magnitude data with a real, rational, minimum-phase
transfer function.
5. Ssv() computes the singular value decomposition of an frd object.
6. Repmat() creates a large matrix B consisting of an M-by-N tiling of copies of
some matrix A.
mxg = diag(xg);
size(mxg)
FRD model with 4 output(s) and 4 input(s), at 80 frequency
point(s).
Example
repmat(randumat(2,2),2,3)
repmat(ureal(`A',6),[4 2])