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

    %% Feedback Loop With Analysis Point Inserted by |connect|
% Create a model of the following block diagram from _r_ to _y_. Insert an
% analysis point at an internal location, _u_.
%%
% 
% <<../analysispoint1.png>>
% 
%%
% Create |C| and |G|, and name the inputs and outputs.

% Copyright 2015 The MathWorks, Inc.

C = pid(2,1); 
C.InputName = 'e';  
C.OutputName = 'u';
G = zpk([],[-1,-1],1);
G.InputName = 'u';  
G.OutputName = 'y';
%% 
% Create the summing junction.  
Sum = sumblk('e = r - y');
%%
% Combine |C|, |G|, and the summing junction to create the aggregate model,
% with an analysis point at _u_.
T = connect(G,C,Sum,'r','y','u')
%%
% The resulting |T| is a |genss| model. The |connect| command creates the
% |AnalysisPoint| block, |AnalysisPoints_|, and inserts it into |T|.    To
% see the name of the analysis point channel in |AnalysisPoints_|, use
% |getPoints|.
getPoints(T)
%%
% The analysis point channel is named |'u'|.  You can use this analysis
% point to extract system responses.  For example, the following commands
% extract the open-loop transfer at _u_ and the closed-loop response at _y_ to a
% disturbance injected at _u_.
L = getLoopTransfer(T,'u',-1);
Tuy = getIOTransfer(T,'u','y');
%%
% |T| is equivalent to the following block diagram, where _AP_u_ designates
% the |AnalysisPoint| block |AnalysisPoints_| with channel name _u_.
% 
% <<../analysispoint2.png>>
%