This demo shows how the Optimization Toolbox can be used to solve a pole-placement problem using the multiobjective goal attainment method.
Consider here a 2-input 2-output unstable plant.
A = [ -0.5 0 0; 0 -2 10; 0 1 -2 ]; B = [ 1 0; -2 2; 0 1 ]; C = [ 1 0 0; 0 0 1 ];
Suppose we wish to design an output feedback controller, x, to have poles to the left of the location [-5, -3, -1] in the complex plane. The controller must not have any gain element exceeding an absolute value of 4.
goal = [-5, -3, -1]
goal = -5 -3 -1
Set the weights equal to the goals to ensure same percentage under- or over-attainment in the goals.
weight = abs(goal)
weight = 5 3 1
Initialize output feedback controller
x0 = [ -1 -1; -1 -1];
Set upper and lower bounds on the controller
lb = repmat(-4,size(x0)) ub = repmat(4,size(x0))
lb = -4 -4 -4 -4 ub = 4 4 4 4
Set optimization display parameter to give output at each iteration:
options = optimset('Display','iter');
Create a vector-valued function eigfun that returns the eigenvalues of the closed loop system. This function requires additional parameters (namely, the matrices A, B, and C); the most convenient way to pass these is through an anonymous function:
eigfun = @(x) sort(eig(A+B*x*C))
eigfun = @(x) sort(eig(A+B*x*C))
To begin the optimization we call FGOALATTAIN:
[x,fval,attainfactor,exitflag,output,lambda] = ...
fgoalattain(eigfun,x0,goal,weight,[],[],[],[],lb,ub,[],options);
Attainment Directional Iter F-count factor Step-size derivative Procedure 0 6 1.88521 1 13 1.061 1 1.03 2 20 0.4211 1 -0.679 3 27 -0.06352 1 -0.523 Hessian modified 4 34 -0.1571 1 -0.053 Hessian modified twice 5 41 -0.3489 1 -0.133 6 48 -0.3643 1 -0.00768 Hessian modified 7 55 -0.3645 1 -4.25e-005 Hessian modified 8 62 -0.3674 1 -0.00303 Hessian modified twice 9 69 -0.3806 1 -0.0213 Hessian modified 10 76 -0.3862 1 0.00266 11 83 -0.3863 1 -2.73e-005 Hessian modified twice 12 90 -0.3863 1 -7.72e-014 Hessian modified twice Optimization terminated: Search direction less than 2*options.TolX and maximum constraint violation is less than options.TolCon. Active inequalities (to within options.TolCon = 1e-006): lower upper ineqlin ineqnonlin 1 1 2 2 4
The value of the control parameters at the solution is:
x
x = -4.0000 -0.2564 -4.0000 -4.0000
The eigenvalues of the closed loop system are as follows:
eigfun(x) % These values are also held in output fval
ans = -6.9313 -4.1588 -1.4099
The attainment factor indicates the level of goal achievement. A negative attainment factor indicates over-achievement, positive indicates under-achievement. The value attainfactor we obtained in this run indicates that the objectives have been over-achieved by about 39 percent:
attainfactor
attainfactor = -0.3863
Suppose we now require the eigenvalues to be as near as possible to the goal values, [-5, -3, -1]. Set options.GoalsExactAchieve to the number of objectives that should be as near as possible to the goals (i.e., do not try to over-achieve):
% All three objectives should be as near as possible to the goals. options = optimset(options,'GoalsExactAchieve',3);
We are ready to call the optimization solver:
[x,fval,attainfactor,exitflag,output,lambda] = ...
fgoalattain(eigfun,x0,goal,weight,[],[],[],[],lb,ub,[],options);
Attainment Directional Iter F-count factor Step-size derivative Procedure 0 6 1.88521 1 13 1.061 1 1.03 2 20 0.4211 1 -0.679 3 27 0.1437 1 -0.2 Hessian modified 4 34 0.06407 1 -0.126 Hessian modified 5 41 0.005703 1 -0.0268 Hessian modified 6 48 9.619e-006 1 -2.11e-017 Hessian modified 7 55 4.733e-011 1 2.96e-019 Hessian modified Optimization terminated: Magnitude of directional derivative in search direction less than 2*options.TolFun and maximum constraint violation is less than options.TolCon. Active inequalities (to within options.TolCon = 1e-006): lower upper ineqlin ineqnonlin 1 2 3 4 5 6
This time the eigenvalues of the closed loop system are as follows:
eigfun(x) % These values are also held in output fval
ans = -5.0000 -3.0000 -1.0000
The attainment factor is the level of goal achievement. A negative attainment factor indicates over-achievement, positive indicates under-achievement. The low attainfactor obtained indicates that the eigenvalues have almost exactly met the goals:
attainfactor
attainfactor = -1.9343e-021