My code is here.

cvx_begin sdp

variable P(1,K)

variable t1

expressions ap(1,K) b_k(1,K) R_k(1,K) Z_k(1,K)

%%

% a_ij*p

ap0 = zeros(1,K);

for j = 1:K

for i = 1:K

ap0(i) = ap0(i)+a_ij0(i,j)*P0(i);

end

end

```
% ap
ap(1) = P(1)+a_ij0(2,1)*P(2)+a_ij0(3,1)*P(3)+a_ij0(4,1)*P(4)+a_ij0(5,1)*P(5)+a_ij0(6,1)*P(6)+a_ij0(7,1)*P(7);
ap(2) = P(2)+a_ij0(1,2)*P(1)+a_ij0(3,2)*P(3)+a_ij0(4,2)*P(4)+a_ij0(5,2)*P(5)+a_ij0(6,2)*P(6)+a_ij0(7,2)*P(7);
ap(3) = P(3)+a_ij0(1,3)*P(1)+a_ij0(2,3)*P(2)+a_ij0(4,3)*P(4)+a_ij0(5,3)*P(5)+a_ij0(6,3)*P(6)+a_ij0(7,3)*P(7);
ap(4) = P(4)+a_ij0(1,4)*P(1)+a_ij0(2,4)*P(2)+a_ij0(3,4)*P(3)+a_ij0(5,4)*P(5)+a_ij0(6,4)*P(6)+a_ij0(7,4)*P(7);
ap(5) = P(5)+a_ij0(1,5)*P(1)+a_ij0(2,5)*P(2)+a_ij0(3,5)*P(3)+a_ij0(4,5)*P(4)+a_ij0(6,5)*P(6)+a_ij0(7,5)*P(7);
ap(6) = P(6)+a_ij0(1,6)*P(1)+a_ij0(2,6)*P(2)+a_ij0(3,6)*P(3)+a_ij0(4,6)*P(4)+a_ij0(5,6)*P(5)+a_ij0(7,6)*P(7);
ap(7) = P(7)+a_ij0(1,7)*P(1)+a_ij0(2,7)*P(2)+a_ij0(3,7)*P(3)+a_ij0(4,7)*P(4)+a_ij0(5,7)*P(5)+a_ij0(6,7)*P(6);
% b_k
b_k0 = zeros(1,K);
h_ak = h_ak_path(K,q0,U,PL,FL,L);
H_k = Hk_path(K,N,U,r,q0,L,PL,FL,d,wl);
for i = 1:K
b_k0(i) = (h_ak(i)+v0'*H_k(:,i))^2*(ap0(i)-P0(i))+noise;
b_k(i) = (h_ak(i)+v0'*H_k(:,i))^2*(ap(i)-P(i))+noise;
end
for i = 1:K
R_k = -2*real((h_ak(i)+v0'*H_k(:,i))*sqrt(P0(i))*(h_ak(i)+v0'*H_k(:,i))*pow_pos(P(i),0.5))/(b_k0(i)*log(2))... % sqrt(P)
+(((h_ak(i)+v0'*H_k(:,i))*sqrt(P0(i)))^2)*(b_k(i)+((h_ak(i)+v0'*H_k(:,i))*pow_pos(P(i),0.5))^2)/...
(b_k0(i).*(b_k0(i)+((h_ak(i)+v0'*H_k(:,i)).*sqrt(P0(i))).^2)*log(2));
end
%Z_k_up
c = A1_c(N,q0,r,E,PL,FL,u_max);
for i = 1:K
Z_k(i) = c*sum(ap(i)-ap0(i))/((c*ap0(i)+noise)*log(2))...
-log(c*(ap(i)-P(i))+noise)*(1/log(2));
end
%%
maximize t1
subject to
sum(P) <= P_max;
for i = 1:K
t1 + R_k(i) + Z_k(i) <= 0;
end
```

cvx_end

MATLAB reports the following error.

Disciplined convex programming error:

Invalid operation: sqrt( {positive convex} )

出错 .^ (line 25)

出错 pow_pos (line 12)

出错 A1 (line 47)

R_k = -2*real((h_ak(i)+v0’*H_k(:,i))*sqrt(P0(i))*(h_ak(i)+v0’*H_k(:,i))*pow_pos(P(i),0.5))/(b_k0(i)*log(2))… % sqrt§

Hope to get a solution. Thanks.