www.gusucode.com > slcontrol 案例源码程序 matlab代码 > slcontrol/ObtainOpenLoopResponseTransferFunctionforSpecificParametExample.m
%% Obtain Open-Loop Response Transfer Function for Specific Parameter Combination % Suppose you batch linearize the |scdcascade| model for multiple transfer % functions. For most linearizations, you vary the proportional (|Kp2|) % and integral gain (|Ki2|) of the |C2| controller in the 10% range. For % this example, calculate the open-loop response transfer function for the % inner loop, from |e2| to |y2|, for the maximum value of |Kp2| and |Ki2|. %% % Open the |scdcascade| model. mdl = 'scdcascade'; open_system(mdl); %% % Create an |slLinearizer| interface for the model. sllin = slLinearizer(mdl); %% % Vary the proportional (|Kp2|) and integral gain (|Ki2|) of the |C2| controller % in the 10% range. Kp2_range = linspace(0.9*Kp2,1.1*Kp2,3); Ki2_range = linspace(0.9*Ki2,1.1*Ki2,5); [Kp2_grid,Ki2_grid] = ndgrid(Kp2_range,Ki2_range); params(1).Name = 'Kp2'; params(1).Value = Kp2_grid; params(2).Name = 'Ki2'; params(2).Value = Ki2_grid; sllin.Parameters = params; %% % To calculate the open-loop transfer function for the inner loop, use |e2| % and |y2| as analysis points. To eliminate the effects of the outer loop, % break the loop at |e2|. Add |e2| and |y2| to |sllin| as analysis points. addPoint(sllin,{'e2','y2'}) %% % Determine the index for the maximum values of |Ki2| and |Kp2|. mdl_index = params(1).Value == max(Kp2_range) & params(2).Value == max(Ki2_range); %% % Obtain the open-loop transfer function from |e2| to |y2|. sys = getIOTransfer(sllin,'e2','y2','e2',mdl_index);