Open ltiarray2uss_demo.m in the Editor
Run in the Command Window

Modeling a Family of Responses as an Uncertain System

This demo uses Robust Control Toolbox™ command ltiarray2uss to derive an uncertain multiinput, multioutput model that captures the response of an array of models.

We will demonstrate how to choose a suitable uncertainty model using the ltiarray2uss function to derive an uncertain model from a collection of LTI models.

Contents

Single-Input, Single-Output Example

First we need to create some artificial data. Create a first-order system with uncertain steady-state gain and uncertain time constant. Sample this uncertain system at 30 points using usample to yield an array of LTI systems. In a real application, this data might arise from repeated frequency response measurements and fitting, with variability expected due to unknown process variability and parasitic effects.

gamma = ureal('gamma',2,'Perc',30);
tau = ureal('tau',1,'Perc',30);
sys = tf(gamma,[tau 1]);
Parray = usample(sys,30);


% Also pick the nominal value of the uncertain system to be the
% "center" point for the new representation.
P = sys.NominalValue;

At this point, we have a single system, P, and an array of systems, Parray. The command ltiarray2uss will generate an uncertain system, using only additive, unstructured unmodeled dynamics uncertainty to cover the systems in the array, with an uncertain model centered at P.

[Usys,Wt1] = ltiarray2uss(P,Parray,1);
[Usys,Wt2] = ltiarray2uss(P,Parray,2);
[Usys,Wt3] = ltiarray2uss(P,Parray,3);
[Usys,Wt4] = ltiarray2uss(P,Parray,4);

sysnomg = frd(sys.Nom,logspace(-2,2,60));

M = 30;
sysa = usample(sys,M);

Nvec = [1 3 5 7 9];
N = length(Nvec);
umod = cell(N,1);
wt = cell(N,1);
differ = cell(N,1);

allnormsA = zeros(N,M);
for i=Nvec
   [umod{i},wt{i},differ{i}] = ltiarray2uss(sys.Nominal,sysa,i);
end

Creating the Uncertain Plant Model

Use Pnom to denote the 2-state, 2-input, 2-output nominal model.

alpha = 10;
A = [-5 alpha;-alpha -5];
B = [1 0;0 1];
C = [1 alpha;-alpha 1];
D = [0 0;0 0];
Pnom = ss(A,B,C,D);

An uncertain plant model with input uncertainty is constructed. Use two individual ultidyn objects to model individual uncertainty in each channel. The first channel has 20% uncertainty at low frequency, rising to 100% at 20 rads/s. The second channel has 40% uncertainty at low frequency, rising to 100% at 55 rads/s.

Delta1 = ultidyn('Delta1',[1 1]);  % 1-by-1 gain-bounded, unmodeled dynamics
Delta2 = ultidyn('Delta2',[1 1]);  % 1-by-1 gain-bounded, unmodeled dynamics
W1 = makeweight(0.2,20,10);        % DCGain=0.2, Gain=1 at 20, HighFreqGain=10
W2 = makeweight(0.4,55,10);        % DCGain=0.4, Gain=1 at 55, HighFreqGain=10

P = Pnom*blkdiag(1+Delta1*W1,1+Delta2*W2);

Creating an Array of LTI Models

From the uncertain state-space P construct an array of 40 models in the set using the usample command.

[Pdata,samp] = usample(P,40);

The Bode magnitude plot shows the range of the sampled plant models

om = logspace(-1,3,120);
Pdatag = frd(Pdata,om);
bodemag(Pdatag)

Figure 1: Bode magnitude plot of sampled plant models

Creating an Uncertain State-Space from the State-Space Array

The command ltiarray2uss computes an uncertain system bounding LTI SS array. The calling sequence is the SS array, nominal model, order of the uncertainty weight and type of uncertain description of the model set.

help ltiarray2uss
 --- help for lti/ltiarray2uss ---

  LTIARRAY2USS   Computes uncertain system bounding given LTI SS array
 
  USYS = LTIARRAY2USS(P,PARRAY,ORD) calculates an uncertain system
  USYS with nominal value P, and whose range of behavior includes
  the given array of systems, PARRAY.  USYS employs an input 
  multiplicative uncertainty model, of the form
          USYS = P*(I + WT*ULTIDYN('Name',[size(P,2) size(P,2)]))
  where WT is a stable scalar system, whose magnitude overbounds
  the relative difference, (P-PARRAY)/P.  The state dimension of WT is ORD.
  Both P and PARRAY must be in the classes SS/TF/ZPK/FRD.  If P is an FRD,
  then USYS will be a UFRD object, otherwise USYS will be a USS object.
  The name of the ULTIDYN atom is based on the variable name of PARRAY
  in the calling workspace.
 
  [USYS,WT] = LTIARRAY2USS(P,PARRAY,ORD) returns the weight WT used
  to bound the infinity norm of (P-PARRAY)/P.  
 
  [USYS,WT] = LTIARRAY2USS(P,PARRAY,ORD,'OutputMult') uses multiplicative
  uncertainty at the plant output (as opposed to additive uncertainty).  
  The formula for USYS is 
    USYS = (I + WT*ULTIDYN('Name',[size(P,1) size(P,1)]))*P
 
  [USYS,WT] = LTIARRAY2USS(P,PARRAY,ORD,'Additive') uses additive
  uncertainty.  This is the default uncertainty type. 
    USYS = P + WT*ULTIDYN('Name',[size(P,1) size(P,2)])
 
  [USYS,WT] = LTIARRAY2USS(P,PARRAY,ORD,'InputMult') uses multiplicative
  uncertainty at the plant input (this is the default). The formula for USYS is 
    USYS = P*(I + WT*ULTIDYN('Name',[size(P,2) size(P,2)]))
 
  [USYS,WT,DIFFDATA] = LTIARRAY2USS(P,PARRAY,ORD,TYPE) returns the norm of
  the difference (absolute difference for Additive, and relative difference
  for Multiplicative) between the nominal model P and PARRAY.  WT satisfies
  DIFFDATA(w_i) < |WT(w_i)| at all frequency points.
 
  See also: FITMAGFRD, USS, ULTIDYN

    Reference page in Help browser
       doc ltiarray2uss

Additive Uncertainty Model of LTI Models

Initially ltiarray2uss an additive model is used to describe the collection of models in Psa. wt corresponds to the additive uncertainty weight. Try a first-order additive uncertainty weight. Plot the additive weight

[umodela1,wta1,diff1] = ltiarray2uss(Pnom,Pdatag,1,'Additive');
bodemag(wta1,'b',diff1,'k',om);
legend('1st order additive weight','Model Difference','Location','SouthEast')

Figure 2: Bode magnitude plot of first-order additive weight

A sample of the uncertain model set, umodel1, at the same value of the original uncertainty Psamp versus the SS array, Psa.

umodela1s = usample(umodela1,40);
umodela1sg = frd(umodela1s,om);
bodemag(Pdatag,'b',umodela1sg,'r')

Figure 3: Bode magnitude plot of uncertain model set samples

Now try a second-order additive uncertainty weight. Plot the additive weight

[umodela2,wta2,diff2] = ltiarray2uss(Pnom,Pdatag,2,'Additive');
bodemag(wta1,'b',wta2,'r',diff2,'k',om);
legend('1st order additive weight','2nd order additive weight',...
   'Model Difference','Location','SouthEast')

Figure 4: Bode magnitude plot of second-order additive weight

Sample the uncertain model set, umodel2, at 40 values of the uncertainty set. Plot the results of a second-order description of the uncertainty.

umodela2s = usample(umodela2,40);
umodela2sg = frd(umodela2s,om);
bodemag(Pdatag,'b',umodela2sg,'r')

Figure 5: Bode magnitude plot of uncertain model set samples

Input Multiplicative Uncertainty Model of LTI Models

Now use an input multiplicative uncertainty model to describe the collection of models in Psa. wt corresponds to the input multiplicative uncertainty weight. Try to capture the model variation with a first-order weight. Plot the input multiplicative weight

[umodeli1,wti1,diffin1] = ltiarray2uss(Pnom,Pdatag,1,'InputMult');
bodemag(wti1,'b',diffin1,'k',om);

Figure 6: Bode magnitude plot of first-order input multilpicative weight

Sample the uncertain model set, umodeli1, at 40 values of the uncertainty set. Plot the results of a first-order input multiplicative description of the uncertainty.

umodeli1s = usample(umodeli1,40);
umodeli1sg = frd(umodeli1s,om);
bodemag(Pdatag,'b',umodeli1sg,'r')

Figure 7: Bode magnitude plot of uncertain model set samples

Now try a second-order input multiplicative uncertainty weight. Plot the multiplicative weight

[umodeli2,wti2] = ltiarray2uss(Pnom,Pdatag,2,'InputMult');
bodemag(wti1,'b',wti2,'r',om);
legend('1st order input weight','2nd order input weight','Location','SouthEast')

Figure 8: Bode magnitude plot of second-order input multiplicative weight

Sample the uncertain model set, umodel2, at 40 values of the uncertainty set. Plot the results of a second-order input multiplicative description of the uncertainty.

umodeli2s = usample(umodeli2,40);
umodeli2sg = frd(umodeli2s,om);
bodemag(Pdatag,'b',umodeli2sg,'r')

Figure 9: Bode magnitude plot of uncertain model set samples