www.gusucode.com > robust 案例源码程序 matlab代码 > robust/WorstCasePeakGainOfClosedLoopSystemExample.m

    %% Worst-Case Peak Gain of Closed-Loop System
% Consider a control system whose plant is nominaly an integrator with some
% additive dynamic uncertainty. Create a model of the plant.
%%
delta = ultidyn('delta',[1 1],'bound',0.4); 
G = tf(1,[1 0]) + delta;
%%
% Create a PD controller for the model. Suppose you want to examine the
% worst-case disturbance rejection performance. Build the closed-loop
% sensitivity function to examine the worst-case gain of a
% disturbance at the plant input.
C = pid(2,0,-0.04,0.02);
S = feedback(1,G*C);
%%
% Because of the uncertainty, the frequency response of this transfer
% function falls within some envelope. The frequency-response magnitude of
% a few samples of the system gives a sense of that envelope.
bodemag(S)
%%
% Each sample has a different peak gain.  Find the highest peak-gain value
% within the envelope and the corresponding values for the uncertain
% elements.
[wcg,wcu] = wcgain(S);
wcg
%%
% The |LowerBound| and |UpperBound| fields of |wcg| show that the
% worst-case peak gain is around 5.1. This gain occurs at the critical
% frequency around 10.6 rad/s. 
%%
% The output |wcu| is a structure that contains the perturbation to 
% |delta| that causes the worst-case gain. Confirm the result by
% substituting this value into the sensitivity function.
Swc = usubs(S,wcu);
getPeakGain(Swc)
%%
% Because the system has dynamic uncertainty |delta| with gain not
% exceeding 0.4, the worst-case value of |delta| should be a system with peak
% gain of 0.4.  Confirm this result.
getPeakGain(wcu.delta)