source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/demos/maxdetex.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 1.9 KB
Line 
1clc
2echo 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)
12pause
13clc
14% Consider the discrete-time system x(k+1)=Ax(k+1)+Bu(k), u = -Lx
15A = [1 0;0.4 1];
16B = [0.4;0.08];
17L = [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
22pause % Strike any key to continue.
23
24% Define the symmetric matrix Y
25Y = sdpvar(2,2);
26pause % Strike any key to continue.
27
28% Define LMI for invariance and constraint satisfaction
29F = set( [Y Y*(A-B*L)';(A-B*L)*Y Y] > 0);
30F = F + set(L*Y*L' <1);
31pause % 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%
51pause
52
53solution = solvesdp(F,-geomean(Y));
54pause % Strike any key to continue.
55
56% Get result
57Y = double(Y)
58pause % Strike any key to continue.
59echo off
Note: See TracBrowser for help on using the repository browser.