I’m trying to solve a problem. The following is my code:
cvx_begin
variable w nonnegative;
variable x(n,1) complex;
minimize( norm(x,1) );
subject to
W_matrix(1:m,1:m) = w;
W_matrix(num1, = 1;
W_matrix = diag(diag(W_matrix));
norm(W_matrix*(y-A*x),2) <= u;
cvx_end
where w and x are variables, W_matrix is a diagonal matrix with 1 or w of the diagonal elements, y is a given vector with positive values, m and n is a given positive constant, num1 is a given positive array, A is a given matrix and u is a given positive value.

But it pop up this error massage:
Error using cvx/mtimes (line 126)
Disciplined convex programming error:
Only scalar quadratic forms can be specified in CVX
Error in test1w (line 71)
norm(W_matrix*(y-A*x),2) <= u;
I can’t find out why, please help me. Thank you so much.

This is non-convex, because it involves the product of optimization variables. If W_matrix were not a CVX variable or expression, it would be a convex constraint which would be accepted by CVX.

I don’t understand what your W_matrix really is - you seem to form it in an unusual manner. If you need to optimize over W_matrix, then you need a non-convex solver. If you are content with fixing a candidate W_matrix, you can numerically assign W_matrix in MATLAB, then solve for x using CVX.