beta_vec = -10:5:10; % Beta Range
[alpha,beta] = ndgrid(alpha_vec,beta_vec);
SG = struct('alpha',alpha,'beta',beta);
% Proportional gains
alphabetaBasis = polyBasis('canonical',2,2);
P_PHI = tunableSurface('Pphi', 0.05, SG, alphabetaBasis);
P_ALPHA = tunableSurface('Palpha', 0.05, SG, alphabetaBasis);
P_BETA = tunableSurface('Pbeta', -0.05, SG, alphabetaBasis);
ST0.setBlockParam('P phi',P_PHI);
ST0.setBlockParam('P alpha',P_ALPHA);
ST0.setBlockParam('P beta',P_BETA);
% Integral gains
alphaBasis = @(alpha) alpha;
betaBasis = @(beta) abs(beta);
alphabetaBasis = ndBasis(alphaBasis,betaBasis);
I_PHI = tunableSurface('Iphi', 0.05, SG, alphabetaBasis);
I_ALPHA = tunableSurface('Ialpha', 0.05, SG, alphabetaBasis);
I_BETA = tunableSurface('Ibeta', -0.05, SG, alphabetaBasis);
ST0.setBlockParam('I phi',I_PHI);
ST0.setBlockParam('I alpha',I_ALPHA);
ST0.setBlockParam('I beta',I_BETA);
Note that we initialized each gain surface to a fixed value suggested by the baseline
design. In general, it is not recommended to start from a zero or random initial point
because the difficulty of the problem increases the likelihood of getting stuck in
uninteresting local minima. Instead, a better strategy consists of tuning a fixed (non-
scheduled) set of gains against the full set (or a relevant subset) of design points. Such
"robust design" typically provides a good starting point for gain surface tuning.
You can now use systune to tune the 6 gain surfaces against the three tuning goals.
ST = systune(ST0,[R1 R2 R3]);
Final: Soft = 1.03, Hard = -Inf, Iterations = 42
The final objective value is close to 1 so the tuning goals are essentially met. Plot the
closed-loop angular responses and compare with the baseline design.
T = getIOTransfer(ST,'Demand',{'Phi_deg','Alpha_deg','Beta_deg'});
step(T0,T,6)
legend('Baseline','Tuned','Location','SouthEast')
11 Gain-Scheduled Controllers