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

    %% Sensitivity Function at a Location  
% Compute the sensitivity at the plant input, marked by the analysis point |X|.    
%
% <<../getlooptransfer2.png>>
%

%% 
% Create a model of the system by specifying and connecting a numeric LTI
% plant model |G|, a tunable controller |C|, and the |AnalysisPoint| block
% |X|. Use the |AnalysisPoint| block to mark the location where you assess
% the sensitivity (plant input in this example). 
G = tf([1],[1 5]);
C = tunablePID('C','p');
C.Kp.Value = 3;
X = AnalysisPoint('X');
T = feedback(G*X*C,1); 

%%
% |T| is a |genss| model that represents the closed-loop response of the
% control system from $r$ to $y$. The model contains the |AnalysisPoint|
% block, |X|, that identifies the analysis point.  

%% 
% Calculate the sensitivity, $S$, at |X|. 
S = getSensitivity(T,'X');
tf(S)