source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/lmirank/lmiranktest2.m @ 37

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

Added original make3d

File size: 2.4 KB
Line 
1
2function [A,Bperp,Ctperp,y,info,X,Y] = lmiranktest2
3% [A,Bperp,Ctperp,y,info,X,Y] = lmiranktest2;
4%
5% LMIRANKTEST2 runs a test problem for LMIRANK.
6% The problem is a two-mass-spring, reduced order output feedback problem
7% considered in
8%
9%       R. Orsi, U. Helmke, and J. B. Moore. A Newton-like method for solving
10%       rank constrained linear matrix inequalities. In Proceedings of the
11%       43rd IEEE Conference on Decision and Control, pages 3138-3144,
12%       Paradise Island, Bahamas, 2004. 
13%
14% It is of the form:
15%
16%       Find symmetric matrices X and Y such that
17%
18%        -Bperp*(A*X+X*A')*Bperp' > 0,          (1)
19%      -Ctperp*(Y*A+A'*Y)*Ctperp' > 0,          (2)
20%                      [X I; I Y] >= 0,         (3)
21%                  rank[X I; I Y] <= n + k.     (4)
22% % The code first uses YALMIP to convert constraints (1), (2) and (3) into
23% the SeDuMi data format. (This is the format used by LMIRANK.) After
24% specifying the rank constraint, LMIRANK is called. Using the solution of
25% LMIRANK, X and Y are reconstructed using YALMIP. Finally, the minimum
26% eigenvalues of the left hand sides of (1), (2) and (3) are displayed,
27% along with the rank in (4).
28%
29% See also LMIRANK.
30
31% Author Robert Orsi
32% Feb 2005
33
34
35%%%% Problem data
36alpha=0.2;
37A=[ 0  0 1 0; 0  0 0 1; -1  1 0 0; 1 -1 0 0];
38A=A+alpha*eye(size(A));
39Bperp=[1 0 0 0; 0 1 0 0; 0 0 0 1 ];
40Ctperp=[1 0 0 0; 0 0 1 0; 0 0 0 1];
41epsilon = 1e-6;
42k=2; % controller order
43
44%%%% Determine various sizes
45n=size(A,2);
46m=size(Bperp,1);
47p=size(Ctperp,1);
48
49%%%% Create A,c,K using YALMIP
50yalmip('clear');
51X=sdpvar(n,n);
52Y=sdpvar(n,n);
53M1=-Bperp*(A*X+X*A')*Bperp';
54M2=-Ctperp*(Y*A+A'*Y)*Ctperp';
55M3=[X eye(n); eye(n) Y];
56F=set( M1 > epsilon*eye(m) ) + set( M2 > epsilon*eye(p) ) + set( M3 > 0 );
57[model,recoverymodel] = export(F,[],sdpsettings('solver','sedumi'));
58At=model.A;
59c=model.C;
60K.s=model.K.s;
61
62%%%% Specify rank constraint
63K.rank=[m p (n+k)];
64
65%%%% Call LMIRank
66pars.itermod=10;   
67[y,info] = lmirank(At,c,K,pars);
68
69%%%% Reconstruct X and Y from y using YALMIP
70setsdpvar(recover(recoverymodel.used_variables),y);
71X=double(X);
72Y=double(Y);
73
74%%%% Testing
75M1=double(M1);
76M2=double(M2);
77M3=double(M3);
78disp(' ');
79disp(['min eig M1 =  ',num2str(min(eig(M1)),2)]);
80disp(['min eig M2 =  ',num2str(min(eig(M2)),2)]);
81disp(['min eig M3 =  ',num2str(min(eig(M3)),2)]);
82disp(['rank M3 =  ',num2str(rank(M3),2)]);
83disp(' ');
84
Note: See TracBrowser for help on using the repository browser.