Rev | Line | |
---|
[37] | 1 |
|
---|
| 2 | function [At,c,K,yfeas] = createrandomdata(nF,nG,r,m)
|
---|
| 3 | % [At,c,K,yfeas] = createrandomdata(nF,nG,r,m);
|
---|
| 4 | %
|
---|
| 5 | % CREATERANDOMDATA randomly generates feasible rank constrained LMI problems
|
---|
| 6 | % that can be used to test LMIRANK. |
---|
| 7 | %
|
---|
| 8 | % Inputs:
|
---|
| 9 | % nF : the Fi matrices are size nF x nF
|
---|
| 10 | % nG : the Gi matrices are size nG x nG
|
---|
| 11 | % r : rank bound
|
---|
| 12 | % m : number of varibales
|
---|
| 13 | %
|
---|
| 14 | % Outputs:
|
---|
| 15 | % At = -[vec(F1),...,vec(Fm);
|
---|
| 16 | % vec(G1),...,vec(Gm)]
|
---|
| 17 | % c = [vec(F0);
|
---|
| 18 | % vec(G0)]
|
---|
| 19 | % K : problem parameters (K.s and K.rank)
|
---|
| 20 | % yfeas : known feasible solution
|
---|
| 21 | %
|
---|
| 22 | % See also LMIRANK, LMIRANKTEST.
|
---|
| 23 |
|
---|
| 24 | % Author Robert Orsi
|
---|
| 25 | % Feb 2005
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 | %%%% Create y
|
---|
| 29 | y=randn(m,1);
|
---|
| 30 | yfeas=y; % used for testing only
|
---|
| 31 |
|
---|
| 32 | %%%% Create At
|
---|
| 33 | At=zeros(nF^2+nG^2,m);
|
---|
| 34 | c=zeros(nF^2+nG^2,1);
|
---|
| 35 | for i=1:m,
|
---|
| 36 | Fi=randn(nF);
|
---|
| 37 | Fi=sqrt(0.5)*(Fi+Fi');
|
---|
| 38 | Gi=randn(nG);
|
---|
| 39 | Gi=sqrt(0.5)*(Gi+Gi');
|
---|
| 40 | At(:,i)=-[Fi(:); Gi(:)];
|
---|
| 41 | end
|
---|
| 42 |
|
---|
| 43 | %% Create X=X'>=0
|
---|
| 44 | X=randn(nF);
|
---|
| 45 | X=X+X';
|
---|
| 46 | [V,D]=eig(X);
|
---|
| 47 | d=randn(nF,1);
|
---|
| 48 | d=max(d,0);
|
---|
| 49 | X=V*diag(d)*V';
|
---|
| 50 | X=(X+X')/2;
|
---|
| 51 | %% Create Y=Y'>=0, rank(Y)=r
|
---|
| 52 | Y=randn(nG);
|
---|
| 53 | Y=Y+Y';
|
---|
| 54 | [V,D]=eig(Y);
|
---|
| 55 | d=[rand(r,1);zeros(nG-r,1)];
|
---|
| 56 | Y=V*diag(d)*V';
|
---|
| 57 | Y=(Y+Y')/2;
|
---|
| 58 |
|
---|
| 59 | %%%% Create c
|
---|
| 60 | c=At*y+[X(:);Y(:)];
|
---|
| 61 |
|
---|
| 62 | %%%% Create K
|
---|
| 63 | K.s=[nF nG];
|
---|
| 64 | K.rank=[nF r];
|
---|
| 65 |
|
---|
| 66 |
|
---|
Note: See
TracBrowser
for help on using the repository browser.