only x is a variable

I wrote the code as follows

```
cvx_clear
cvx_begin
cvx_solver mosek
variable X(M,1)
variable eta
variable z
maximize eta
subject to
% variable I_m(1,N)
I_m = cvx(zeros(1,N));
R = cvx(zeros(1));
for m=1:M
R = R+b(m)*(log2(H_ST_m(m))+X(m)*log2(exp(1)))-c(m);
R1 = cvx(zeros(1));
for m1 =1:M
if Interfering_users(m,m1)>0
{X(Interfering_users(m,m1)),1,z} == exponential(1);
R1 = R1+z;
end
end
R = R-b(m)*(-rel_entr(1,(R1*H_ST_m(m)+Im(m)+B*n0)))*1.44;
end
eta<=R;
for n = 1:N
for k=1:K
for m=1:M
I_m(1,n) = I_m(1,n) + X_out(m,k)*P(m,1)*X_PU(n,k)*g_BS_m(m,n);
end
end
I_m(1,n) <= In; % C1
end
for m=1:M
{X(m),1,0} == exponential(1);
end
cvx_end
```

The current error is as follows

Disciplined convex programming error:

Invalid constraint: {real affine} <= {convex}

出错 <= (第 21 行)

b = newcnstr( evalin( ‘caller’, ‘cvx_problem’, ‘’ ), x, y, ‘<=’ );

出错 untitled (第 37 行)

eta<=R;

I’d appreciate it if I got help

I haven’t tried to decipher exactly what you are doing, but it seems like your code doesn’t match the problem in the image.

The 2nd term of R_{m,k} can be handled with `log_sum_exp`

. The other exponentials in the problem can be handled directly with `exp`

, without explicitly setting exponential cone constraints.

C3 isn’t directly allowed in CVX, but seems to be unnecessary, because it should be satisfied bu virtue of `exp(...) `

being nonnegative.

Thank you very much

But for the 2nd term of Rm,k ,only a few of the variables x are included.So,how use log_sum_exp to handle it.

`log(a+f1*exp(x1)+f2*exp(x2)) = log_sum_exp([log(a);x1+log(f1);x2+log(f2)];)`

Use the correct indexing, and extend this to all the terms inside the log. And divide log_sum_exp by log(2) because of the log2 rather than log. I leave you to attend to those details.

## Thank you very much

Unfortunately, however,I met other errors

Calling Mosek 9.1.9: 92 variables, 31 equality constraints

For improved efficiency, Mosek is solving the dual problem.

Status: Error

Optimal value (cvx_optval): NaN

无法将类型为 struct 的值用作索引。

出错 cvxprob/solve (第 429 行)

[ x, status, tprec, iters, y ] = shim.solve( At, b, c, cones, quiet, prec, solv.settings, eargs{:} );

出错 cvx_end (第 88 行)

solve( prob );

出错 untitled (第 47 行)

cvx_end

I tried not to use mosek ,but I met the same error

I restarted matlab. This problem has been successfully resolved. Thanks again