Hello, this is my code, I have the following error, but I don’t know what to do, please help me thank you
Disciplined convex programming error:
Cannot perform the operation: {concave} ./ {convex}
wrong ./ (第 19 行)
z = times( x, y, ‘./’ );
wrong Untitled7 (第 39 行)
maximize(sum(Q_total) ./ sum_inv_P_total_times_T)
B = 10^6;
sigma_squared = -90;
sigma_squared = 10^(sigma_squared/10);
E_max = 100;
P_max = 20;
R_min = 0;
I = 3;
T = 1000;
T_0 = 0;
T_2 = T;
A = 1;
rho_0 = 1;
d_i = [1, 2, 3];
% Optimization with CVX
cvx_begin
variables P_total(T) % Variables to be optimized
expression Q_total(I)
variables inv_P_total(T) % New variable for the inverse of transmission power
% Compute the step size for Riemann sum approximation
delta_t = T / numel(T);
for i = 1:I
R_i = B * log(1 + (P_total .* (A * rho_0 * d_i(i)^-2) ./ sigma_squared)) / log(2);
Q_total(i) = sum(R_i) * delta_t;
% C3: Data rate constraints
R_i >= R_min;
end
% Compute the inverse of transmission power
inv_P_total = 1 *inv_pos(P_total);
% Sum of inv_P_total multiplied by T for the objective
sum_inv_P_total_times_T = sum(inv_P_total) .* T;
maximize(sum(Q_total) ./ sum_inv_P_total_times_T)
subject to
sum(P_total) * T <= E_max;
P_total <= P_max;
cvx_end