# use cvx to solve SDP,Why is this a problem?

Untitled

very likely an error that will produce unexpected results. Please check
the LMI; and, if necessary, re-enter the model.
In cvxprob.newcnstr at 241
In cvx.ge at 21
In Untitled at 62

## Calling SDPT3 4.0: 20 variables, 8 equality constraints For improved efficiency, SDPT3 is solving the dual problem.

num. of constraints = 8
dim. of sdp var = 8, num. of sdp blk = 2

SDPT3: Infeasible path-following algorithms

## number of iterations = 27 residual of primal infeasibility certificate (y,Z) = 3.50e-10 reldist to infeas. <= 1.38e-05 Total CPU time (secs) = 0.61 CPU time per iteration = 0.02 termination code = 1 DIMACS: 5.8e-13 0.0e+00 1.0e-08 0.0e+00 7.7e-09 1.1e-08

Status: Unbounded
Optimal value (cvx_optval): -Inf

1 Like

1 Like
``````%无线网络节点坐标
s1=[0,0];   %参考节点
s2=[260,150];
s3=[0,300];
s4=[-260,150];
s5=[200,-150];
s=[s1;s2;s3;s4;s5];
%目标节点
u=[50,100];

%生成TDOA测量值
d=zeros(1,5);
for i=1:5
d(i)=norm((u-s(i,:)));
end

tdoa=zeros(1,4);
for i=1:4
tdoa(i)=(d(i+1)-d(1))+3*randn(1,1);
end
%生成AOA测量值
thta=zeros(1,5);
for i=1:5
thta(i)=atan((u(2)-s(i,2))/(u(1)-s(i,1)))+randn(1,1);
end
%G矩阵
G1=[];
G2=[];
for i=1:4
g1=[s(i+1,1)-s(1,1),s(i+1,2)-s(1,2),tdoa(i)];
G1=[G1;g1];
end
for i=1:5
g2=[sin(thta(i)),-cos(thta(i)),0];
G2=[G2;g2];
end

G=[G1;G2];
%h矩阵
h1=[];
h2=[];
for i=1:4
h11=1/2*[(s(i+1,1)-s(1,1)).^2+(s(i+1,2)-s(1,2)).^2-(tdoa(i)).^2];
h1=[h1;h11];
end
h2=[0];
for i=1:4
h22=[(s(i+1,1)-s(1,1))*sin(thta(i+1))-(s(i+1,2)-s(1,2))*cos(thta(i+1))];
h2=[h2;h22]; %行扩展
end
h=[h1;h2];
W=eye(9);
n=4;
C=[G'*inv(W)*G,-G'*inv(W)*h;-h'*inv(W)*G,h'*inv(W)*h];
K=diag([1,1,-1,0]);
cvx_begin sdp
variables Z(3,3) z(3,1)
minimize(trace(C*[Z z;z.' 1]));
subject to
trace(K*[Z z;z' 1]) == 0;
[Z z;z' 1] == semidefinite(4);
[Z z;z' 1]>=0;
cvx_end``````
1 Like

The warning message
`This linear matrix inequality appears to be unsymmetric.`
is because you didn’t declare `Z` to be symmetric.

However, after making that correction
`variable Z(3,3) symmetric`
it is still the case that the problem is unbounded.

Also note that your inclusion of both
`[Z z;z' 1] == semidefinite(4);`
and
`[Z z;z' 1]>=0;`
is redundant. Both of these constraints are the same given that you have invoked sdp mode. However your inclusion of both doesn’tt seem to do any harm, and the result is the same if one of these code lines is removed.

I think your problem is assessed by the solver as unbounded because C is very poorly scaled. I changed the objective to
`minimize(trace(1e-8*C*[Z z;z.' 1]));`
and got an optimal solution.

1 Like

`>> disp(C)`

``````   1.0e+09 *

0.000175203062655  -0.000029999623029   0.000013132054229  -0.006438738509987
-0.000029999623029   0.000157501937345   0.000047772408445  -0.019623581791272
0.000013132054229   0.000047772408445   0.000092574956830  -0.015905590544226
-0.006438738509987  -0.019623581791272  -0.015905590544226   4.046452272095730``````
1 Like