www.gusucode.com > control 案例程序 matlab源码代码 > control/GetGoalAtDesignPointFromVaryingTuningGoalExample.m
%% Get Goal at Design Point from Varying Tuning Goal % Suppose you use the following 5-by-5 grid of % design points to tune your controller. [alpha,V] = ndgrid(linspace(0,20,5),linspace(700,1300,5)); %% % Create a variable tuning goal that specifies gain and phase margins at a signal % named |'u'| that vary across a grid of design points. [GM,PM] = ndgrid(linspace(7,20,5),linspace(45,70,5)); FH = @(gm,pm) TuningGoal.Margins('u',gm,pm); VG = varyingGoal(FH,GM,PM); %% % Use the grid to specify the |SamplingGrid| property of |VG|. VG.SamplingGrid = struct('alpha',alpha,'V',V); %% % Evaluate this variable design goal at |(alpha,V) = (5,1150)|. This point % is the second |alpha| value and the fourth |V| value, so you can index % into the |varyingGoal| using |(k1,k2) = (2,4)|. TGi = getGoal(VG,'index',2,4); %% % Because you have the specific |(alpha,V)| values at which you want the % tuning goal, you can use those values instead of indexing. TGv = getGoal(VG,'value',5,1150)