Disciplined convex programming error: Cannot minimize a(n) invalid expression.

cvx_begin quiet
variables p(UE,AP)
expression ta_2(UE,AP)
ta_1 = 0;
for m = 1:UE
for j = 1:N
for k = 1:AP
if map_UE_AP(m,k)~=0
if k<=BS+UAV
ta_2(m,k) = prob_f(j)(map_UE_AP(m,k)/AP_UE_BW(k,m))BUE_fK(j,k)(inv_pos(-rel_entr(1,pow_p(10,(p(m,k)-pathloss_dB(m,k)-SINR_N_dB)/1000)))/log(2))+prob_f(j)tp(m,k);
%ta_2(m,k)= prob_f(j)
(map_UE_AP(m,k)/AP_UE_BW(k,m))(BUE_fK(j,k)(inv_pos(log(1+pow_p(10,(p(m,k)-pathloss_dB(m,k)-SINR_N_dB)/1000)))/log(2)))+prob_f(j)tp(m,k); %m从k获得j的部分
else
ta_2(m,k) = prob_f(j)
(map_UE_AP(m,k)/AP_UE_BW(k,m))BUE_fK(j,k)
(inv_pos(-rel_entr(1,pow_p(10,(p(m,k)-10)/1000)))/log(2))+prob_f(j)tp(m,k);
%ta_2(m,k) = prob_f(j)
(map_UE_AP(m,k)/AP_UE_BW(k,m))(BUE_fK(j,k)*(inv_pos(log(1+pow_p(10,(p(m,k)-10)/1000)))/log(2)))+prob_f(j)*tp(m,k); %m从k获得j的部分
end
end
end
ta_1 = ta_1+max(ta_2(m,:));
end
end

``````        tt1 = ta_1 + Tbh;
P = sum(p);
minimize(tt1)
subject to
0<= p(:,1:BS) <=pms.BS_power_dBm;
0<= p(:,BS+1:BS+UAV) <=pms.UAV_power_dBm;
0<= p(:,BS+UAV+1:end) <=pms.BS_power_dBm;
0<= P(1:BS) <=pms.BS_power_dBm;
0<= P(BS+1:BS+UAV) <=pms.UAV_power_dBm;
0<= P(:,BS+UAV+1:end) <=pms.SAT_power_dBm;
cvx_end
``````

Likely one or both of `ta_1` (which arises from `ta_2`) and `Tbh` are `NaN`, which CVX considers to be invalid. Look at their values prior to the `minimize` statement. The track back to which statements or input data caused the `NaN`.
Are you calling CVX in a loop, such as SCA, in which the argmin from iteration is used as input to the next? if so, and one iteration fails due to being infeasible, unbounded, or solver encountering numerical difficulties, the CVX variables will be populated with NaN`, which can then result in some input data being `NaN` in the next CVX iteration.