Thank you for the response, Mark, and sorry for not providing the code; it’s just a direct translation of the problem. Here goes:

```
cvx_begin
variable W(N,2);
**expression R_Ul_i(N,I);**
expression I_U_k(N,K);
expression trjlim(N-1,1);
for n = 1:N
for i = 1:I
**X_i = p*rho/(noisvar*log(2))*inv_pos(square(H^2+norm(W_r(n,:)-L_U(i,:))))*inv_pos(1+p*rho/(noisvar*(H^2+norm(W_r(n,:)-L_U(i,:)))));**
**Y_i = log(1+p*rho/noisvar*inv_pos(H^2+norm(W_r(n,:)-L_U(i,:))))/log(2);**
**R_Ul_i(n,i) = -X_i*(norm(W(n,:)-L_U(i,:))-norm(W_r(n,:)-L_U(i,:)))+Y_i;**
end
for k = 1:K
I_U_k(n,k) = H^2+norm(W_r(n,:)-L_BS(k,:))+2*(W_r(n,:)-L_BS(k,:))*(W(n,:)-W_r(n,:)).';
end
if (n < N)
trjlim(n) = norm(W(n+1)-W(n));
end
end
**R_U_i_2 = 1/N*sum(s.*R_Ul_i);**
R_sum_2 = sum(R_U_i_2);
maximize( R_sum_2 );
**subject to**
**R_U_i_2 >= eta;**
I_U_k >= p*rho/gamma;
W(1,:) == W(N,:);
trjlim <= (v*T/N)^2;
cvx_end
```

**Note: The parts between double asterisks in the code are the one in question. Also, inputs {N,I,K,H,v,eta,T,p,rho,gamma,L_BS,L_U} are all predefined paramters, {s} is obtained by solving a previous optimization subproblem, and {W_r} is clearly the previous iteration result for the decision variable {W}.**

Consequent error message:

```
Disciplined convex programming error:
Cannot perform the operation: {negative constant}
.* {convex}
Error in * (line 36)
z = feval( oper, x, y );
Error in Alg_1 (line 52)
R_Ul_i(n,i) =
-X_i*(norm(W(n,:)-L_U(i,:))-norm(W_r(n,:)-L_U(i,:)))+Y_i;
```