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

    %% Loop-Shaping Controller Design
% 
%% Create HiMAT model

% Copyright 2015 The MathWorks, Inc.

ag =[ -2.2567e-02  -3.6617e+01  -1.8897e+01  -3.2090e+01   3.2509e+00  -7.6257e-01; 
       9.2572e-05  -1.8997e+00   9.8312e-01  -7.2562e-04  -1.7080e-01  -4.9652e-03; 
       1.2338e-02   1.1720e+01  -2.6316e+00   8.7582e-04  -3.1604e+01   2.2396e+01; 
       0            0   1.0000e+00            0            0            0; 
       0            0            0            0  -3.0000e+01            0; 
       0            0            0            0            0  -3.0000e+01]; 
bg = [ 0     0; 
       0     0; 
       0     0; 
       0     0; 
       30     0; 
       0    30]; 
cg = [ 0     1     0     0     0     0; 
       0     0     0     1     0     0]; 
dg = [ 0     0; 
       0     0]; 
G = ss(ag,bg,cg,dg);
% NASA HiMAT model G(s)
%% Design Controller and Plot Results
s = zpk('s'); 
w0 = 10; 
Gd = w0/(s+.001);
[K,CL,GAM] = loopsyn(G,Gd); % Design a loop-shaping controller K

% Plot the results
sigma(G*K,'r',Gd,'k-.',Gd/GAM,'k:',Gd*GAM,'k:',{.1,30})
legend('Achieved Loop Shape','Target Loop Shape','Gd/GAM','Gd*GAM')
figure
T = feedback(G*K,eye(2));
sigma(T,ss(GAM),'r*',{.1,30});
legend('Closed loop','GAM')
grid