# Cvx error. I have search for one day but find nothing. I don't known where I'm wrong. I hope someone can help me!

function [optimal_x_UAV,optimal_y_UAV] = UAV_Location_Subproblem(N,M,N0,B,beta_U,beta_B,Rcmin,UE_x,UE_y,x_UAV_1,y_UAV_1,h_UAV,A1,p_ue,p_uav)
a = A1;
x = [UE_x’,UE_y’];
X_1 = [x_UAV_1’,y_UAV_1’];
cvx_begin
variable X(M,2);
variable tempt_Slack_var(1,M);

``````expression r(N,M);
expression C1(1,N);
expression r_uav_B(1,M);
expression tempt_C2(1,M);
expression C3(1,M);

for i=1:N
for j=1:M
r(i,j) = a(i,j)*B*log(1 + p_ue(i)*beta_U/(N0*(square_pos(norm(X_1(j,:)-x(i,:))) + h_UAV^2)))/log(2) - (p_ue(i)*beta_U/(log(2)*N0))*(1/(1+(p_ue(i)*beta_U/(N0*(square_pos(norm(X_1(j,:)-x(i,:))) + h_UAV^2))))) * ( square_pos(norm(X(j,:)-x(i,:))) - square_pos(norm(X_1(j,:) - x(i,:))) )/(square_pos(norm(X_1(j,:) - x(i,:)))+h_UAV^2)^2;
end
C1(i) = sum(r(i,:)) - Rcmin;
end

for m = 1:M
tempt_c_r = 0;
for i = 1:N
if a(i,m)==1
tempt_c_r = tempt_c_r + r(i,m);
end
end
r_uav_B(m) = B*log2(1 + p_uav(m)*beta_B / (pow_pos(norm(X),2) + h_UAV^2));
tempt_C2(m) = tempt_c_r - r_uav_B(m);

end
obj = sum(sum(r));
maximize(obj)
subject to
C1 >= 0;
tempt_C2 <= r_uav_B;
``````

cvx_end

matlab error as follows
Disciplined convex programming error:
Cannot perform the operation: {positive constant} ./ {convex}

z = times( x, y, ‘./’ );

z = feval( oper, x, y );

z = mtimes( x, y, ‘rdivide’ );

r_uav_B(m) = B*log2(1 + p_uav(m)*beta_B / (pow_pos(norm(X),2) + h_UAV^2));

CVX does not allow dividing by a convex expression, which your program does. Have you proven that `tempt_C2 <= r_uav_B` is a convex constraint? Have you proven that the optimization problem you are attempting to enter is convex?

My problem is like this

U = {Xj, Yj}, j in M. Nj is in N belongs to j.

It looks very nonconvex. Why is this convex?

I use the Taylor expansion for rj so it can convert as an concave problem.

Then show us the Taylor expansion formulation which you claim results in a “concave” problem, i.e., a convex optimization problem.

I don’t know what your immediately preceding post is supposed to be. Please show us a complete convex optimization problem, with proof of its convexity.