In an attempt to solve a convex optimization problem, I am running the code below. CVX consistently returns

```
cvx_optval = 0
```

However, when I evaluate the objective function manually, at the end of the code,

```
manual_optval = det_rootn(Hp(1:2,1:2))
```

I get a nonzero number:

```
manual_optval =
0.9547
```

Why is CVX doing this? It’s almost like it’s treating the optimization problem as a feasibility problem… Any thoughts?

**The Code**

```
%specify the problem data
m = 3;
mu = zeros(1,m+1);
mu(1) = 6.7307e3; %cm^-3
mu(2) = 227.8969; %cm^-2
mu(3) = 9.1470; %cm^-1
mu(4) = 0.3850;
k = ceil(m/2);
%specify cvx settings
cvx_precision default
cvx_quiet false
cvx_solver mosek
%describe the SDP
cvx_begin sdp
variable p(max(2*k+2,m) + 1,1) %+1 because of matlab indexing
variable z
expression Hp(k+1,k+1)
expression Bp(k-1+1,k-1+1)
maximize det_rootn(Hp(1:2,1:2))
subject to
%define the entries of the Hankel matrices
for i = 1:(k+1)
for j = 1:(k+1)
Hp(i,j) = p(i+j - 2 + 1); %plus one to account for indexing starting at 1
end
end
%define the entries of the Hankel matrices
for i = 1:(k-1+1)
for j = 1:(k-1+1)
Bp(i,j) = p(i+j - 1 + 1); %plus one to account for indexing starting at 1
end
end
%specify the LMIs
Hp >= 0;
Bp >= 0;
%specify the linear constraints
for j = 0:m
J = j + 1; %calculate the matlab index
p(J) <= mu(J)*z;
end
%specify the other constraints on p and z
p(1+1) == 1;
z >= 0;
cvx_end
if not(strcmp(cvx_status,'Solved'))
warning('CVX did not solve the problem to its default tolerance.')
disp(cvx_status)
end
cvx_optval
manual_optval = det_rootn(Hp(1:2,1:2))
```