Request Help!!!

%% passive beamforming opt
close all
clear all

%% parameter
K = 4; %number of user
L_center = 20;
W_center = 20; %factory [50,50,0] m
R = 10; %radius m

CC=[0 0 0]; %Control center

H = 20; %UAV height m
x = 10;
y = 10;
UAV=[x y H]; %UAV location

rou = 10^(3/10); %Path loss at reference distance of 1m 3dB;

beita = 10; %Rician factor
f = 2.8e10; %carrier frequency hz
lambda = 3e8/f; %wavelength m
d = lambda/2; %Antenna Spacing m

M=64; %number of RIS
N=6; %Number of receiving antennas of Control center

IoT_angle=rand(1,1);
CC_angle=rand(1,1);
RIS_angle=rand(1,1); % AOA AOD

N_0= 10^((-169/3)/10); %noise power spectral density -169dBm/Hz;
B = 2e5; %bandwidth
T = 1e-3; %delay 1ms
L = B*T; %data size 100bits

Ber = randi([1,10]);
BER = 1e-5; %block error rate

%% IoT location
I_L = generate_IoT(K,R,L_center,W_center); %generate location of users

%% figure
figure
plot3(UAV(1),UAV(2),UAV(3),‘ro’);
xlim([0,L_center+R]);ylim([0,W_center+R]);zlim([0,50])
hold on
plot3(CC(1),CC(2),CC(3),‘ro’);
xlim([0,L_center+R]);ylim([0,W_center+R]);zlim([0,50])
hold on
plot3(I_L(:,1),I_L(:,2),I_L(:,3),‘ro’);
xlim([0,L_center+R]);ylim([0,W_center+R]);zlim([0,50])
hold on
theta=linspace(0,1,100).2.pi;
hold on
plot(L_center+R
cos(theta),W_center+R
sin(theta),‘r.’)

%% pathloss
[s_IC,s_UC,s_IU] = generate_pathloss(K,CC,UAV,I_L,rou);

%% initial three channel
ite = 1e2; %number of channel realization
[H_ic,H_iu,H_uc,theta,theta_sig] = generate_three_channel(M,N,K,lambda,d,CC_angle,RIS_angle,ite);

%% final three channel and Cascading channel
[H,H_IC,H_IU,H_UC,Theta] = generate_final_channel(M,N,K,theta,s_IC,s_IU,s_UC,IoT_angle,H_ic,H_iu,H_uc,beita,lambda,d,ite);

%% order descend NOMA
H_mod=abs(H).^2;
H_sum=sum(H_mod,1);
[~,order]=sort(H_sum,‘descend’);
H=H(:,order);

%% given beamforming
W = sqrt(1/2).*(rand(N,K)+1j.*rand(N,K));

%%initial q
theta = [theta_sig.’,1];
theta =theta.’;
q=theta*theta’;

%% opt theta parameters
derta = 10; %rate of change of kesai
iter_max = 20; %The maximum number of iterations
threshold = 0.001; %Convergence condition
P_max = 1e-3*10.^(50/10); %max power 50dbm
kesai = 1; %penalty factor
%% matric Z and contant v
[v,Z] = generate_v_Z(H_IU,H_UC,H_IC,W,K,M);

%% Initialize the power of each IoT device
p = zeros(K,1);
for i = 1:K
p(i) = randi([1,10]);
end

%% iter
for i= 1:iter_max

for j = 1:iter_max
    
    %cvx  opt theta
    [Q,P] = CVX_theta_Optimal(M,P_max,K,Z,v,q,p,BER,kesai);    
    
    if norm(Q-q)<threshold
        break
    end
    q = Q;
    p = P;
    kesai = derta*kesai;
end

end

function [H_ic,H_iu,H_uc,theta,theta_sig] = generate_three_channel(M,N,K,lambda,d,CC_angle,RIS_angle,ite)

%% theta_init
theta = zeros(M,1,ite);
H_ic = zeros(N,K,ite);
H_iu = zeros(M,K,ite);
H_uc = zeros(M,N,ite);

for i = 1:ite
theta_sig=exp(1j.*rand(M,1).*2.*pi);
theta(:,:,i) = theta_sig;

%% channel:IoT-CC link H_ic
H_ic_sig=sqrt(1/2).*(randn(N,K)+1j.randn(N,K));
H_ic(:,:,i) = H_ic_sig;
%% channel:IoT-UAV link H_iu
H_iu_sig=sqrt(1/2).
(randn(M,K)+1j.*randn(M,K)) ;
H_iu(:,:,i) = H_iu_sig;

%% channel:UAV-CC link H_uc
H_uc_sig=ULA_fun(RIS_angle,M,lambda,d)*ULA_fun(CC_angle,N,lambda,d)’;
H_uc(:,:,i) = H_uc_sig;

end

end
%%

function [scale_IC,scale_UC,scale_IU] = generate_pathloss(K,CC,UAV,I_L,rou)

% direct link:IoT-CC link
scale_IC=zeros(1,K); %large scale fading IoT to CC
for i=1:K
dt=I_L(i,:)-CC;
d_IC = sqrt(sum(abs(dt).^2));
scale_IC(1,i)=sqrt(rou*d_IC.^(-3));
end

%% UAV-CC link
UC = UAV-CC;
d_UC=sqrt(sum(abs(UC).^2));
scale_UC=sqrt(rou*(d_UC).^(-2)); %large scale fading UAV to CC

%% IoT-UAV link
scale_IU=zeros(1,K); %large scale fading IoT to UAV
for i=1:K
dt=I_L(i,:)-UAV;
d_IU=sqrt(sum(abs(dt).^2));
scale_IU(1,i)=sqrt(rou*(d_IU).^(-2.5));
end
end
function [I_L] = generate_IoT(K,R,L_center,W_center)

I_L=zeros(K,3);
k1=[1 0 0];
k2=[0 1 0];
r = rand(1,K)*R;
theta = rand(1,K)2pi;

for i=1:K
Lx=r(1,i)cos(theta(1,i));
Ly=r(1,i)sin(theta(1,i));
pt=[L_center W_center 0]+Lx
k1+Ly
k2;
I_L(i,:)=pt;
end

end
function [H,H_IC,H_IU,H_UC,Theta] = generate_final_channel(M,N,K,theta,s_IC,s_IU,s_UC,IoT_angle,H_ic,H_iu,H_uc,beita,lambda,d,ite)

c_IC = repmat(s_IC,N,1);
c_IU = repmat(s_IU,M,1);
c_UC= s_UC;

H = zeros(N,K);
H_IC = zeros(N,K);
H_IU = zeros(M,K);
H_UC = zeros(M,N);

for j = 1:ite
Theta = diag(theta(:,:,j)’);
for i = 1:K
%% IC
H_IC(:,i) = c_IC(:,i).H_ic(:,i,j);
%% IU
H_IU(:,i) = c_IU(:,i).
(sqrt(beita/(beita+1)).*(ULA_fun(IoT_angle ,M,lambda,d))+sqrt(1/(beita+1)).*H_iu(:,i,j));
%% UC
H_UC = c_UC.*H_uc(:,:,j);
%% final model
H(:,i)=H_IC(:,i)+H_UC’ThetaH_IU(:,i);

end
end

end

function [Q_,P_] = CVX_theta_Optimal(M,P_max,K,Z,v,q,p,BER,kesai)

cvx_solver mosek
cvx_begin
cvx_quiet false;
variable Q(M+1,M+1) hermitian semidefinite
variable P(K)

expression F(K)
expression G(K)

for i=1:K
     if i == 1
         s_inter = 0;
         G_tmp = 0; 
     else
         s_inter = 0;
         G_tmp = 0;
         for j=1:i-1
           s_inter = p(j).*(trace(Z(:,:,j)*q)+ sum(abs(v(:,i)).^2)) + s_inter;
           G_tmp = G_tmp + Z(:,:,j).';
         end
     end
     G_gradient = G_tmp/log(2)*(s_inter+1);
     G(i) = real((s_inter+1))/log(2)+2*real(trace(G_gradient.'*(Q-q)));
     F(i) = -rel_entr(1,real(trace(Z(:,:,i)*Q)+sum(abs(v(:,i)).^2)))/log(2);
end
     
 %expression N
 %norm_grad = two_norm_grad(q);
 %N = kesai*(norm_nuc(Q)-norm(q)-2*real(trace(norm_grad*norm_grad'*(Q-q)))); 

 %X = sum(P)+N;
 
minimize sum(P)
subject to 
    diag(Q) == 1 ;
    for i =1:K
           P(i)-exp(log(2)*(log(2.^(1+(sqrt(1/200)*qfuncinv(BER)/log(2)))-1))/log(2)+real(G(i)-F(i)))>=0
    end
    for i =1:K
         0<=P<=P_max
    end

cvx_end

P
Q_ = Q;
P_ = P;

end

This is my all code.I modified it for several days and still have the problem, I hope you can help me.Thank you very much!
This is my question.
Status: Infeasible
Optimal value (cvx_optval): +Inf
You can run this code can find this question. CVX 2.2 and mosek 9.1

As I told you in a previous thread:

Follow the advice (except for section 1) at https://yalmip.github.io/debugginginfeasible 1 .

I finally found that it was the scale of my data, how can I change the scale of my data to be more appropriate?Thank you !

For instance having a variable having the unit kg it should have the unit g.

So you should choose new units for variables and constraints so the model become better scaled.

Now Mine is a communication problem, the units are all SI units, do I need to convert them to less commonly used units?

Both g and kg are SI units so that is not the point.

See

https://docs.mosek.com/modeling-cookbook/practical.html?highlight=scaling#scaling