Error:The following CVX variable(s) have been cleared or overwritten

A

This is often an indication that an equality constraint was written with one equals ‘=’ instead of two ‘==’. The model must be rewritten before cvx can proceed.

Code:

for i0=1:ITER_MAX

cvx_begin SDP

cvx_precision high

variable w(U,M) complex

variable A

minimize sum(pow_pos(norm(w,2),2))

subject to

pow_pos(norm(w,2),2)<=50;

A>=0;

for u = 1:U

for m = 1:M

for j = 1:M

if(m==j)

continue;

else

A=A+pow_pos(abs(H(:,u)‘*w(:,j)),2);*

end

end

3(A+1)-2*real(w1(:,m)’*H(:,u).*H(:,u)’*w(:,m))+pow_pos(abs(H(:,u)’*w1(:,m)),2)<=0;

end

end

cvx_end

Thank U so much!

You used `A`

as an expression, by virtue of `A = ...`

, after you declared it as a variable. it appears that you want to use it as an expression, do don’t declare it as a variable. Because it is a scalar, you don’t need to declare it as an expression, and it will have value zero by default before it is first used. If you want the constraint `A >= 0`

, it should be placed after the last update to `A`

is made (i.e. after for loop in which it is assigned), although that would be useless in this program because `A`

has to be nonnegative by virtue of how it is constructed (always adding nonnegative terms to something starting at zero).

Thank U soooo much！

My problem is solved.

I neglected to point out that not only is `A >= 0`

not necessary, but it is not allowed in CVX, because it is `(nonlinear) convex >= 0`

, which is a non-convex constraint.