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

    %% Transfer Function with Additional Loop Openings  
% Compute the open-loop response of the inner loop of the following cascaded
% control system, with the outer loop open.  
%
% <<../getlooptransfer3.png>>
%

%% 
% Create a model of the system by specifying and connecting the numeric
% plant models |G1| and |G2|, the tunable controllers |C1|, and the |AnalysisPoint|
% blocks |X1| and |X2| that mark potential loop-opening locations. 
G1 = tf(10,[1 10]);
G2 = tf([1 2],[1 0.2 10]);
C1 = tunablePID('C','pi');
C2 = tunableGain('G',1);
X1 = AnalysisPoint('X1');
X2 = AnalysisPoint('X2');
T = feedback(G1*feedback(G2*C2,X2)*C1,X1);  

%% 
% Compute the negative-feedback open-loop response of the inner loop, at
% the location |X2|, with the outer loop opened at |X1|. 
L = getLoopTransfer(T,'X2',-1,'X1'); 

%%
% By default, the loop is closed at the analysis-point location marked by
% the |AnalysisPoint| block |X1|. Specifying |'X1'| for the |openings| argument
% causes |getLoopTransfer| to open the loop at |X1| for the purposes of
% computing the requested loop transfer at |X2|. In this example, the negative-feedback
% open-loop response $L(s) = G_{2}(s)C_{2}(s)$.