Based on where the error occurred, I guess the problem occurred because of the following statement:
R(m,1) = b(m)*log(P(m,1)*H_ST_m(m))-b(m)*log(Pmid(m,1)*H_ST_m(m)+Im(m)+B*n0)-c(m);
For this statement, P is a matrix of variables. Pmid represents the variables in this variable matrix other than P (m,1). I want to know if they’re not allowed to be in the same formula. The complete code for the cvx section is as follows. If I can get some help, I would be very grateful
cvx_begin
cvx_solver mosek
variable P(M,1)
variable eta
P >= 0.1;%C3
maximize eta
subject to
I_m = cvx(zeros(1,N));
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
sum(P)+P_c<=P_max;%C2
R = cvx(zeros(M,1));
Pmid = cvx(zeros(M,1));
for m=1:M
for i=1:M
if Interfering_users(m,i)==0
continue
end
Pmid(m,1) = Pmid(m,1)+P(Interfering_users(m,i));
end
R(m,1) = b(m)*log(P(m,1)*H_ST_m(m))-b(m)*log(Pmid(m,1)*H_ST_m(m)+Im(m)+B*n0)-c(m);
R(m,1)>=eta;
end
% sum(R)>=eta;%目标函数
cvx_end