HELP:Cannot perform the operation: {real affine} .* {convex}

``````function [p,r,Vk] = MaxSumRate_CVX(h,No,P_max,K,J,Nt,Nr)
% Maximizing system sum rate using CVX
cvx_begin
cvx_solver mosek
variable p(K,J) nonnegative % The power of each sub message
variable Vk(Nt,J) complex % The digital precoding metrix
dual variables w u
expressions r(K,J) h_gain(K,J) SINR(K,J)
h_gain = []; % Channel gain
for k=1:K
gain{k} = sum(pow_abs(h{k}*Vk,2));
h_gain = [h_gain; gain{k}];
end
SINR = (p.*h_gain)./No; % Calculate SINR
for k=1:K
for j=1:J
r(k,j) = log(SINR(k,j) + 1) ./ log(2);
end
end
maximize sum(r(:))
subject to
w:sum(p(:)) <= P_max;
w:sum(p,1) <= P_max/K;
u:square_pos(norm(Fk)) <= 1;
cvx_end
end
``````

Disciplined convex programming error:
Cannot perform the operation: {real affine} .* {convex}

SINR = (p.*h_gain)./No; % Calculate SINR
I don’t know how to solve it.

p is a real affine expression (scalar) , and h_gain is a cvx convex expression (scalar), h_gain is just a scalar metrix, how can I transfer h_gain to be a real affine expression (scalar)?

You are multiplying the convex expression `h_gain` by another CVX variable, `p`. That is a non-convex operation.

Have you proven this is a convex optimization problem with this choice of optimization variables?