[37] | 1 | clc |
---|
| 2 | echo on |
---|
| 3 | %********************************************************* |
---|
| 4 | % |
---|
| 5 | % Determinant maximization problem |
---|
| 6 | % |
---|
| 7 | %********************************************************* |
---|
| 8 | % |
---|
| 9 | % YALMIP can be used to model determinant maximization |
---|
| 10 | % problems, and solve these problems using any SDP solver |
---|
| 11 | % (i.e., the dedicated solver MAXDET is not needed) |
---|
| 12 | pause |
---|
| 13 | clc |
---|
| 14 | % Consider the discrete-time system x(k+1)=Ax(k+1)+Bu(k), u = -Lx |
---|
| 15 | A = [1 0;0.4 1]; |
---|
| 16 | B = [0.4;0.08]; |
---|
| 17 | L = [1.9034 1.1501]; |
---|
| 18 | |
---|
| 19 | % We want to find the largest possible invariant ellipsoid x'(Y^-1)x < 1 |
---|
| 20 | % for which a control constraint |u|<1 is satisfied |
---|
| 21 | % This can be formulated as a determinant maximization problem |
---|
| 22 | pause % Strike any key to continue. |
---|
| 23 | |
---|
| 24 | % Define the symmetric matrix Y |
---|
| 25 | Y = sdpvar(2,2); |
---|
| 26 | pause % Strike any key to continue. |
---|
| 27 | |
---|
| 28 | % Define LMI for invariance and constraint satisfaction |
---|
| 29 | F = set( [Y Y*(A-B*L)';(A-B*L)*Y Y] > 0); |
---|
| 30 | F = F + set(L*Y*L' <1); |
---|
| 31 | pause % Strike any key to continue. |
---|
| 32 | |
---|
| 33 | % Y should be positive definite and we want to maximize det(Y) |
---|
| 34 | % |
---|
| 35 | % In YALMIP, we can solve this by maximizing det(Y)^(1/(length(Y))) |
---|
| 36 | % which can be modeled using semidefinite and second order cone |
---|
| 37 | % constraints. This function, the geometric mean of the eigenvalues, |
---|
| 38 | % is available in the nonlinear operator geomean. |
---|
| 39 | % |
---|
| 40 | % If you want to get slightly smaller models, you may want to |
---|
| 41 | % replace the operator geomean with geomean2. For matrices with |
---|
| 42 | % dimension not a power of 2, the associated SDP model will |
---|
| 43 | % become a bit more efficiently constructed. Note though that |
---|
| 44 | % geomean2 does not model the geometric mean, but a monotonic |
---|
| 45 | % transformation of this function. |
---|
| 46 | |
---|
| 47 | % NOTE : if you want to use the dedicated solver MAXDET, you must use |
---|
| 48 | % the objective function -logdet(Y) instead. The command logdet may |
---|
| 49 | % however become obsolete in a future version. |
---|
| 50 | % |
---|
| 51 | pause |
---|
| 52 | |
---|
| 53 | solution = solvesdp(F,-geomean(Y)); |
---|
| 54 | pause % Strike any key to continue. |
---|
| 55 | |
---|
| 56 | % Get result |
---|
| 57 | Y = double(Y) |
---|
| 58 | pause % Strike any key to continue. |
---|
| 59 | echo off |
---|