Robust Control Toolbox 

This example shows how to use the Robust Control Toolbox™ commands usample, ucover and dksyn to design a robust controller with standard performance objectives. It can serve as a template for more complex robust control design tasks.
On this page… 

Creating the OpenLoop Design Model First Design: Low Bandwidth Requirement Second Design: Higher Bandwidth Requirement 
The plant model consists of a firstorder system with uncertain gain and time constant in series with a mildly underdamped resonance and significant unmodeled dynamics. The uncertain variables are specified using ureal and ultidyn and the uncertain plant model P is constructed as a product of simple transfer functions:
gamma = ureal('gamma',2,'Perc',30); % uncertain gain tau = ureal('tau',1,'Perc',30); % uncertain timeconstant wn = 50; xi = 0.25; P = tf(gamma,[tau 1]) * tf(wn^2,[1 2*xi*wn wn^2]); % Add unmodeled dynamics delta = ultidyn('delta',[1 1],'SampleStateDim',5,'Bound',1); W = makeweight(0.1,20,10); P = P * (1+W*delta);
A collection of step responses for randomly sampled uncertainty values illustrates the plant variability.
step(P,5)
The uncertain plant model P contains 3 uncertain elements. For feedback design purposes, it is often desirable to simplify the uncertainty model while approximately retaining its overall variability. This is one use of the command ucover. This command takes an array of LTI responses Pa and a nominal response Pn and models the difference PaPn as multiplicative uncertainty in the system dynamics (ultidyn).
To use ucover, first map the uncertain model P into a family of LTI responses using usample. This command samples the uncertain elements in an uncertain system. It returns an array of LTI models where each model representing one possible behavior of the uncertain system. In this example, generate 60 sample values of P:
rng('default'); % the random number generator is seeded for repeatability Parray = usample(P,60);
Next, use ucover to cover all behaviors in Parray by a simple uncertain model of the form
Usys = Pn * (1 + Wt * Delta)
where all the uncertainty is concentrated in the "unmodeled dynamics" component Delta (a ultidyn object). Choose the nominal value of P as center Pn of the cover, and use a 2ndorder shaping filter Wt to capture how the relative gap between Parray and Pn varies with frequency.
Pn = P.NominalValue;
orderWt = 2;
Parrayg = frd(Parray,logspace(3,3,60));
[Usys,Info] = ucover(Parrayg,Pn,orderWt,'in');
Verify that the filter magnitude (in red) "covers" the relative variations of the plant frequency response (in blue).
Wt = Info.W1; bodemag((PnParray)/Pn,'b',Wt,'r')
Creating the OpenLoop Design Model
To design a robust controller for the uncertain plant P, choose a target closedloop bandwidth desBW and perform a sensitivityminimization design using the simplified uncertainty model Usys. The control structure is shown in Figure 1. The main signals are the disturbance d, the measurement noise n, the control signal u, and the plant output y. The filters Wperf and Wnoise reflect the frequency content of the disturbance and noise signals, or equivalently, the frequency bands where good disturbance and noise rejection properties are needed.
Our goal is to keep y close to zero by rejecting the disturbance d and minimizing the impact of the measurement noise n. Equivalently, we want to design a controller that keeps the gain from [d;n] to y "small." Note that
y = Wperf * 1/(1+PC) * d + Wnoise * PC/(1+PC) * n
so the transfer function of interest consists of performance and noiseweighted versions of the sensitivity function 1/(1+PC) and complementary sensitivity function PC/(1+PC).
Figure 1: Control Structure.
Choose the performance weighting function Wperf as a firstorder lowpass filter with magnitude greater than 1 at frequencies below the desired closedloop bandwidth:
desBW = 0.4; Wperf = makeweight(500,desBW,0.5);
To limit the controller bandwidth and induce roll off beyond the desired bandwidth, use a sensor noise model Wnoise with magnitude greater than 1 at frequencies greater than 10*desBW:
Wnoise = 0.0025 * tf([25 7 1],[2.5e5 .007 1]);
Plot the magnitude profiles of Wperf and Wnoise:
bodemag(Wperf,'b',Wnoise,'r'), grid title('Performance weight and sensor noise model') legend('Wperf','Wnoise','Location','SouthEast')
Next build the openloop interconnection of Figure 1:
Usys.InputName = 'u'; Usys.OutputName = 'yp'; Wperf.InputName = 'd'; Wperf.OutputName = 'yd'; Wnoise.InputName = 'n'; Wnoise.OutputName = 'yn'; sumy = sumblk('y = yp + yd'); sume = sumblk('e = y  yn'); M = connect(Usys,Wperf,Wnoise,sumy,sume,{'d','n','u'},{'y','e'});
First Design: Low Bandwidth Requirement
The controller design is carried out with the automated robust design command dksyn. The uncertain openloop model is given by M.
[ny,nu] = size(Usys); [K1,ClosedLoop,muBound] = dksyn(M,ny,nu); muBound
muBound = 0.8533
The muBound is a positive scalar. If it is near 1, then the design is successful and the desired and effective closedloop bandwidths match closely. As a rule of thumb, if muBound is less than 0.85, then the achievable performance can be improved. When muBound is greater than 1.2, then the desired closedloop bandwidth is not achievable for the given amount of plant uncertainty.
Since, here, muBound is approximately 0.82, the objectives are met, but could ultimately be improved upon. For validation purposes, create Bode plots of the openloop response for different values of the uncertainty and note the typical zerodB crossover frequency and phase margin:
opt = bodeoptions; opt.PhaseMatching = 'on'; opt.Grid = 'on'; bodeplot(Parray*K1,{1e2,1e2},opt);
Randomized closedloop Bode plots confirm a closedloop disturbance rejection bandwidth of approximately 0.4 rad/s.
S1 = feedback(1,Parray*K1); % sensitivity to output disturbance
bodemag(S1,{1e2,1e3}), grid
Finally, compute and plot the closedloop responses to a step disturbance at the plant output. These are consistent with the desired closedloop bandwidth of 0.4, with settling times approximately 7 seconds.
step(S1,8);
In this naive design strategy, we have correlated the noise bandwidth with the desired closedloop bandwidth. This simply helps limit the controller bandwidth. A fair perspective is that this approach focuses on output disturbance attenuation in the face of plant model uncertainty. Sensor noise is not truly addressed. Problems with considerable amounts of sensor noise would be dealt with in a different manner.
Second Design: Higher Bandwidth Requirement
Let's redo the design for a higher target bandwidth and adjusting the noise bandwidth as well.
desBW = 2; Wperf = makeweight(500,desBW,0.5); Wperf.InputName = 'd'; Wperf.OutputName = 'yd'; Wnoise = 0.0025 * tf([1 1.4 1],[1e6 0.0014 1]); Wnoise.InputName = 'n'; Wnoise.OutputName = 'yn'; M = connect(Usys,Wperf,Wnoise,sumy,sume,{'d','n','u'},{'y','e'}); [K2,ClosedLoop2,muBound2] = dksyn(M,ny,nu); muBound2
muBound2 = 0.9885
With muBound2 about 0.99, this design achieves a good tradeoff between performance goals and plant uncertainty. Openloop Bode plots confirm a fairly robust design with decent phase margins, but not as good as the lower bandwidth design.
bodeplot(Parray*K2,{1e2,1e2},opt)
Randomized closedloop Bode plots confirm a closedloop bandwidth of approximately 2 rad/s. The frequency response has a bit more peaking than was seen in the lower bandwidth design, due to the increased uncertainty in the model at this frequency. Since the Robust Performance muvalue was 0.99, we expected some degradation in the robustness of the performance objectives over the lower bandwidth design.
S2 = feedback(1,Parray*K2); bodemag(S2,{1e2,1e3}), grid
Closedloop step disturbance responses further illustrate the higher bandwidth response, with reasonable robustness across the plant model variability.
step(S2,8);
Third Design: Very Aggressive Bandwidth Requirement
Redo the design once more with an extremely optimistic closedloop bandwidth goal of 15 rad/s.
desBW = 15; Wperf = makeweight(500,desBW,0.5); Wperf.InputName = 'd'; Wperf.OutputName = 'yd'; Wnoise = 0.0025 * tf([0.018 0.19 1],[0.018e6 0.19e3 1]); Wnoise.InputName = 'n'; Wnoise.OutputName = 'yn'; M = connect(Usys,Wperf,Wnoise,sumy,sume,{'d','n','u'},{'y','e'}); [K3,ClosedLoop3,muBound3] = dksyn(M,ny,nu); muBound3
muBound3 = 1.5817
Since muBound3 is greater than 1.5, the closedloop performance goals are not achieved under plant uncertainties. The frequency responses of the closedloop system have higher peaks indicating the poor performance of the designed controller.
S3 = feedback(1,Parray*K3); bodemag(S3,{1e2,1e3}), grid
Similarly, step responses under uncertainties illustrate the poor closedloop performance.
step(S3,1);
The Bode and Step response plots shown above are generated from samples of the uncertain plant model P. We can use the uncertain model directly, and assess the robust stability of the 3 closedloop systems.
ropt = robopt('Sensitivity','off','Mussv','sm5'); [stabmarg1,destabunc1,report1] = robuststab(feedback(P,K1),ropt); [stabmarg2,destabunc2,report2] = robuststab(feedback(P,K2),ropt); [stabmarg3,destabunc3,report3] = robuststab(feedback(P,K3),ropt);
The robustness analysis reports confirm what we have observed by sampling the closedloop time and frequency responses.
report1 report2 report3
report1 = Uncertain system is robustly stable to modeled uncertainty.  It can tolerate up to 236% of the modeled uncertainty.  A destabilizing combination of 237% of the modeled uncertainty was found.  This combination causes an instability at 5.92 rad/seconds. report2 = Uncertain system is robustly stable to modeled uncertainty.  It can tolerate up to 144% of the modeled uncertainty.  A destabilizing combination of 145% of the modeled uncertainty was found.  This combination causes an instability at 15.4 rad/seconds. report3 = Uncertain system is not robustly stable to modeled uncertainty.  It can tolerate up to 73.7% of the modeled uncertainty.  A destabilizing combination of 73.9% of the modeled uncertainty was found.  This combination causes an instability at 74.2 rad/seconds.