When I try to run the program, Matlab reports the error “Unable to perform assignment because value of type ‘cvx’ is not convertible to ‘double’.”

I tried to define U as ‘expression’ to avoid it, but actually U needs to be used in the iterative process. And when I did that, the program will report another error “An objective has already been supplied for this problem.”

I can’t understand what happened, and don’t know how should I do next.

Hope for your solutions! Thank you faithfully.

The problem needs to solve is:

And W with ‘~’ is the maximum value of the absolute value of matrix W’s elements.

The following is part of my program:

```
cvx_begin sdp
% cvx_solver sdpt3
variable W(L,N) complex;
expression U(N,N);
expression vector(N,1);
for l = 1:L
wl = W(l,:);
s_judge(l) = L - length(find(wl));
% s_judge(l) = sum(wl ~= 0);
end
while (s_judge ~= P)
mu = 1/2*(mu_min + mu_max);
total = 0;
total_s = 0;
for l = 1:L
wl = W(l,:);
W_l = toeplitz(wl,conj(wl));
% W_l = wl*wl';
W_aux = max(abs(wl)) * ones(N,N);
for p = 1:N
for q = 1:N
R_l(p,q) = Rl(l,p,q);
Rs_l(p,q) = Rl_s(l,p,q);
end
end
total = total + real(trace(R_l*W_l)) + mu * real(trace(U*W_aux));
total_s = total_s + trace(Rs_l*W_l);
end
minimize total;
subject to
real(trace(total_s)) >= 1;
for l = 1:L
wl = W(l,:);
W_l = toeplitz(wl,conj(wl));
lambda_p = lambda_max(W_l);
W_l * vector == lambda_p * vector;
prc_vector(:,l) = vector;
% prc_vector(:,l) = V_Wl(1,:); % prc_vector --- principal vector of W^(l)
W_aux = max(abs(wl)) * ones(N,N);
W_l >= 0;
W_aux = W_aux.';
% triu(W_aux) >= triu(W_l);
end
y = 1/L * sum(prc_vector,2);
Y = toeplitz(y,y);
for m = 1:N
for n = 1:N
tmp = Y(m,n) + epsilon;
U(m,n) = inv_pos(tmp);
end
end
if s_judge > P
mu_min = mu;
else s_judge < P;
mu_max = mu;
end
end
cvx_end
```