A strange error in running an SDP

Hi there and thanks in advance for your help regarding my problem. I have a SDP which is convex and can be easily solved by CVX. However, I am receiving an strange error and I can not figure out where I am doing something wrong. To give a background on the problem, this is an SDP relaxation of the TDOA localization problem which is nonconvex in its original form. It is a well-known relaxation and well-known researchers such as Zhi-Quan Luo have proposed it earlier. I tried to simulate it but can not get passed this CVX error. The error is as follows:

??? Subscript indices must either be real positive integers or logicals.

Error in ==> cvx_extract at 344
tmpv = sum(dbcA(temp,:)~=0,2)==1;

Error in ==> cvx_solve at 26
[ At, cones, sgn, Q, P, exps, dualized ] = cvx_extract( shim.config, shim.name );

Error in ==> cvx_finish at 57
[ status, result, bound, iters, tol ] = cvx_solve;

Error in ==> cvx_end at 11
evalin( ‘caller’, ‘cvx_finish’ );

Error in ==> Centralized_test at 226
cvx_end

I checked this error and it seems that an index zero is somehow generated in temp which causes the error. Below, I have attached the code for this problem:

clear all
close all
clc

N=6;
Xmax=1;
sig_v=0.1;
dim=2;

xt=Xmax*rand([dim,1]);

x=Xmax*rand([dim,N-1]);

for i=1:N-1
r(i)=norm(x(:,i)-xt)-norm(xt)+sig_v*randn;
end

% Semi-Definite Relaxation of the NLS (Tom Luo Approach)
delta=10^(-5);

C=zeros(N-1,N);
for i=1:N-1
C(i,1)=1;
C(i,i+1)=-1;
end

clear X G

cvx_solver sedumi

cvx_begin SDP
variable z
variable X(dim,1)
variable g(N,1)
variable G(N,N) symmetric

GG=[G g; g' 1];
GGI=[1 g'; g G];
CC=[C'*C -C'*r'; -r*C r*r'];
XX=[eye(dim,dim) X; X' z];
xx=zeros(dim+1,1);
xx(:,1)=[zeros(dim,1); -1];
for i=2:N
    xx(:,i)=[x(:,i-1); -1];
end

minimize trace(GG*CC)
subject to
    GGI >= 0
    XX >= 0
    for i=1:N
        g(i,1) >= 0;
    end
    G(1,1)==xx(:,1)'*XX*xx(:,1);
    for i=1:N-1
        G(i+1,i+1)==xx(:,i+1)'*XX*xx(:,i+1);
    end
    for i=1:N-1
        G(i+1,1) >= xx(:,i+1)'*XX*xx(:,1);
        G(i+1,1) >= -xx(:,i+1)'*XX*xx(:,1);
    end
    for i=1:N-1
        for j=i+1:N-1
            G(i+1,j+1) >= xx(:,i+1)'*XX*xx(:,j+1);
            G(i+1,j+1) >= -xx(:,i+1)'*XX*xx(:,j+1);
        end
    end

cvx_end

cvx_status

yhat6=X;

error6=norm(xt-yhat6)^2

I just ran it with the result “Status: Solved” and no error messages or warnings. I used CVX version 2.1 (Build 1110) under MATLAB R2014A WIN64.

I recommend you provide your configuration information.

Take a look at SDP in CVX 3.0 fails due to Subscript indices must either be real positive integers or logicals and I got the following CVX message .

Hi Mark,

Thank you for sending me the link. It seems that we have the same problem. Because as I checked there appears to be a zero index in cone.indices that is later deposited in temp. I use MATLAB 7.8.0 R2009a. However, I can not determine the version of CVX because CVX folder does not have any number either 2.1 or 3. Can you tell me how to check for CVX version?

Issue the command
cvx_version
at the MATLAB prompt

Thanks Mark. It is version 3.0beta and my machine is 64-bit. What would you suggest I should do? Should I delete it and install version 2.1? or there are other solutions also?

I don’t know. You could try uninstalling 3.0beta and installing 2.1. Alternatively, check to see whether you have the latest build of 3.0beta - if not, you could try the latest build and see whether that does the trick.

Per the 3.0beta Download page

This is prerelease software. We’ve worked hard to stamp out the big bugs, but of course we need your help to squash more!.

I’d definitely recommend 2.1 in a case like this. 3.0 completion has been delayed a bit so a quick bug fix turnaround isn’t too likely.

I installed CVX 2.1 and it works fine. It was a bug with CVX 3.0beta release.