www.gusucode.com > control 案例程序 matlab源码代码 > control/SISOMarginReqEvalWithAddLoopOpeningExample.m

    %% SISO Margin Requirement Evaluated with Additional Loop Opening  
% Create a margin requirement for the inner loop of the following control
% system. The requirement imposes a minimum gain margin of 5 dB and a minimum
% phase margin of 40 degrees.    
%%
% 
% <<../tuninggoal5b.png>>
% 
%% 
% Create a model of the system. To do so, specify and connect the numeric
% plant models |G1| and |G2|, and the tunable controllers |C1| and |C2|.
% Also specify and connect the |AnalysisPoint| blocks |AP1| and |AP2| that mark
% points of interest for analysis and tuning. 
G1 = tf(10,[1 10]);
G2 = tf([1 2],[1 0.2 10]);
C1 = tunablePID('C','pi');
C2 = tunableGain('G',1);
AP1 = AnalysisPoint('AP1');
AP2 = AnalysisPoint('AP2');
T = feedback(G1*feedback(G2*C2,AP2)*C1,AP1);  

%% 
% Create a tuning requirement object. 
Req = TuningGoal.Margins('AP2',5,40); 

%%
% This requirement imposes the specified stability margins on the feedback
% loop identified by the |AnalysisPoint| channel |'AP2'|, which is the inner loop.  

%% 
% Specify that these margins are evaluated with the outer loop of the control
% system open. 
Req.Openings = {'AP1'}; 

%%
% Adding |'AP1'| to the |Openings| property of the tuning requirements object
% ensures that |systune| evaluates the requirement with the loop open at
% that location. 

%%
% Use |systune| to tune the free parameters of |T| to meet the tuning requirement
% specified by |Req|. You can then use |viewSpec| to validate the tuned
% control system against the requirement.