# How to solve this error: Cannot perform the operation: {convex} ./ {convex}

Can anyone help me to fix these errors.

This is the equation that i am using to maximize Wc.

here is my code
% Iterative Optimization of Wc and Phi
for outer_iter = 1:OutNmax
% Step 1: Optimize Wc given Phi
cvx_begin quiet
variable Wc(M, K) complex;
SINR = zeros(K, 1);
for k = 1:K
barHbsue = (Hirsue(:, k)’ * Phi * Hbsirs + Hbsue(:, k)‘)’;
R_k = Wc(:, k)’ * barHbsue;
interference_plus_noise = 0;
for j = 1:K
if j ~= k
interference_plus_noise = interference_plus_noise + square_pos(norm(Wc(:, j)’ * barHbsue));
end
end
interference_plus_noise = interference_plus_noise + sigma1^2 * square_pos(norm(barHbsue)) + sigmaz^2;
SINR(k) = R_k * R_k’ / interference_plus_noise;
end
maximize(sum(log(1 + SINR)));
subject to
trace(Wc * Wc’) <= Pbs; % Power constraint
cvx_end
Error information:
Disciplined convex programming error:
Cannot perform the operation: {convex} ./ {convex}

Error in ./ (line 19)
z = times( x, y, ‘./’ );

Error in * (line 36)
z = feval( oper, x, y );

Error in / (line 15)
z = mtimes( x, y, ‘rdivide’ );

Error in Code_scratch (line 77)
SINR(k) = R_k * R_k’ / interference_plus_noise;

Aside from breaking multiple CVX rules, your code doesn’t even seem to correspond to the image.

I don’t know why you have `R*R'` in numerator of SINR. SINR is basically
`h'*R*h/(h'*R*h + constant)`. I don’t know what `square_pos(norm(Wc(:, j)’ * barHbsue));` is supposed to be, because (17) shows \Phi, which should be input data for this CVX problem per your comment, “Step 1: Optimize Wc given Phi”. I have no idea whether when SINR is properly fixed up,it can be incorporated into `log(1+SINR)` in away which makes the latter concave and in accordance with CVX’s rules.

I don’t know whether you are declaring the correct things as CVX variables. For instance, should `R`, and not `w` be the CVX variable, and then formulate problem which relaxes (or ignores) `R = w*w'`. You need to intimately understand all that.

Your first order of business is to write out a CONVEX optimization problem for CVX to solve at each iteration. You need to prove that problem is convex. if you have done so, you then need to enter it following CVX"s rules.

As for SINR, if you get past the non-convexities, etc, it is an expression, and because you are indexing into it when assigning, you need to declare it as an expression, not setting it to zeros(k,1). CVX initializes all declared expressions to all zeros. The Basics — CVX Users' Guide

Because your code is in such a horrible shape, I won’t try to find all the problems with it