^_^ Cannot perform the operation: {complex affine} .* {convex}

Dear developer, I encountered this problem, please take a look
cvx_begin
variable P(num_targets,D) nonnegative;
variable F(num_targets,D) complex;

for i = 1:num_targets
    for d = 1:D
        gamma_E = (h(i)' * sum_square_abs(F(i,d')) * h(i)) / N_0;
    end
end

and the error infor is
错误使用 .* (第 173 行)
Disciplined convex programming error:
Cannot perform the operation: {complex affine} .* {convex}

出错 * (第 36 行)
z = feval( oper, x, y );

出错 TDMA (第 75 行)
gamma_E = (h(i)’ * sum_square_abs(F(i,d’)) * h(i)) / N_0;

Based on the error, it appears that h(i) must be complex input data, not real. The solution might be to rearrange (h(i)'*h(i)), then multiply by the rest of the expression.

BTW, your program keeps overwriting gamma_E Therefore,when used later in your program, its value will correspond only to the last time through the for loops, i.e., i = num_targets, d = D

So presumably you will need to change something in the program so that it does what you want.

yeah thank for your great reply :grinning:

But now I have encountered a new problem. I tried big M but couldn’t solve it. I hope you can take a look
variable P(num_targets,D) nonnegative; % power allocation matrix
variable A(num_targets,D) binary; % binary allocation matrix

% Objective
obj = 0;
for i = 1:num_targets
    for d = 1:D
        %gamma_E = (h(i)' * sum_square_abs(F(i,d)') * h(i)) / N_0;
        gamma_E = (h(i)' * F(i,d) * conj(F(i,d)') * h(i)) / N_0;  % effective channel gain          
        obj = obj + A(i,d) * B * log(1 + P(i,d) * gamma_E);
    end
end

then, the error infor is like that
Disciplined convex programming error:
Cannot perform the operation: {real affine} .* {concave}

出错 * (第 36 行)
z = feval( oper, x, y );

出错 TDMA (第 77 行)
obj = obj + A(i,d) * B * log(1 + P(i,d) * gamma_E);

You are violating CVX"s DCP rules. You have something like log(1+a*x*y^2) which is neither convex nor concave when x and y are variables.