www.gusucode.com > slcontrol 案例源码程序 matlab代码 > slcontrol/ObtainComplementarySensitivityFunctionforSpecificParametExample.m
%% Obtain Complementary Sensitivity 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 complementary sensitivity function for the % inner loop 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 complementary sensitivity of the inner loop, use the % |y2| signal as the analysis point. To eliminate the effects of the outer % loop, break the outer loop at |y1m|. Add both these points to |sllin|. addPoint(sllin,{'y2','y1m'}) %% % 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 complementary sensitivity transfer function at |y2|. sys = getCompSensitivity(sllin,'y2','y1m',mdl_index);