Error in constraint

My constraint is this x/(b-cx)<d;
and b-cx>0;
but it says

A=x
F=b-cx。
I need help.

Provided that d is a constant, rather than a CVX variable or expression, you can multiply out the denominator
x <= d*(b-c*x)
Note: I used non-strict inequality. if you use a stric inequality in CVX, it will be treated as non-strict inequality.

if d is a CvX variable or expression, the constraint is non-convex.

And if you want to help yourself, the best way is to follow the advice I provided in reply to your previous question. About division in constraints

If the constraint is x/(b-c*x)+1/y<=d,how could I do?
And y is a CVX variable,and y>0

If the constraint is x/(b-c*x)+1/y+z<=d,how could I do?
And y is a CVX variable,and y>0.
And z is a CVX variable,and z>0.

That looks like a non-convex constraint to me.

Perhaps you have not followed my advice to read Why isn't CVX accepting my model? READ THIS FIRST! . Please read it carefully.

No, it is a convex constraint.And let me prove it.
When y>0,1/y is a convex constraint.
When z>0, z is a convex constraint.
When b-cx>0,x/(b-cx)is a convex constraint.
Let f(x)=x/(b-cx);
f’(x)=b/(b-cx)^2
f’’(x)=2b/(b-cx)^3, if b-c
x>0,f’’(x)>0,so it is a convex constraint.

Individual terms are not constraints.

Your derivatives of f(x) are incorrect.

Sorry, I mean that x/(b-c*x)+1/y+z<=d is convex.

But it is not. I recommend you study the first 5 chapters of https://web.stanford.edu/~boyd/cvxbook/ to learn the basics of convex analysis and optimization.

It is better to say that it can be convex, depending on the values of b,c and the range of x. For the rational functions appearing in your inequality you can use the approach of https://docs.mosek.com/modeling-cookbook/cqo.html#rational-functions Then make a separate bound for each term in your sum and add them up.

Thank you, but I need the cvx of matlab.

sir,I will give you my code, but it will be too long. You could locate the location directly after you run it

N=3;%定义终端数目i
M=5;%定义节点数目m
J=3;%定义任务种类j
%向量t存放用户对应的任务τi
t=zeros(1,N);
for i=1:N
t(i)=round((J-1)*rand(1,1)+1);%为每个用户i分配任务种类
end
%disp(t);

%矩阵n存放从i到m发射单位数据需要的能量,对应ηim
n=zeros(N,M);
for i=1:N
for m=1:M
n(i,m)=rand(1,1);
end
end
%disp(n);

%定义任务j的五元组Rj,Sj,Zj,vmcτi(从节点到云的时延),Tj(时间阈值)
J_req=zeros(J,5);
for J=1:J
J_req(J,:)=round(rand(1,5)*4+1);
end

%存放每个任务的五元组,分别是Rτi,Zτi,Sτi,vmcτi(从节点到云的时延),Tj(时间阈值)
Req=zeros(N,5);
for i=1:N
for j=1:J
if(t(i)==j)%表示用户i的任务类型为j,这时把j的需求赋值给用户需求矩阵中的第i行
Req(i,:)=J_req(j,:);
end
end
end

%con_19约束
lmd=[5,4,9];
SL=[4,7,6];

%con_20约束
SE=[1,2,3,4,5];
S=[4,7,9];

%con_21约束
FEm=4*rand(1,M)+1;%定义FEm,取值范围是1-5

%con_22约束
%定义终端i与节点m的传输速率C
C=ones(N,M);%范围是1-5

%con_23约束
Ci0=rand(1,N);%定义Ci0

H=cell(1,100);
H_idx=1;%用于H_cell的下标索引
H0=[0,1;0,1;0,1;0,1;0,100];%存放初始的变量范围
vimL=0;
vimU=100;

[LBH0,LBSH0,check_val_L]=solve(t,n,J_req,Req,lmd,SL,SE,S,FEm,C,Ci0,H0,vimL);%解决P3,H0

function [obj_val,var_val,check_val]=solve(t,n,J_req,Req,lmd,SL,SE,S,FEm,C,Ci0,H,vimLU)
N=3;%定义终端数目i
M=5;%定义节点数目m
J=3;%定义任务种类j
Fi=[1,4,7];%定义节点i的计算能力
ki=[0.1,0.1,0.1];%表示能量系数

% Mi=zeros(N,M);
% Mi=[1 0 0 1 0;0 0 1 1 1;0 1 1 0 1];
% Nmj=zeros(N,M,J);
% Nmj(:,:,1)=[0 0 0 0 0;0 0 0 1 0;0 1 0 0 0];
% Nmj(:,:,2)=[1 0 0 1 0;0 0 1 0 1;0 0 0 0 1];
% Nmj(:,:,3)=[0 0 0 0 0;0 0 0 0 0;0 0 1 0 0];

Mi=zeros(N,M);
Nmj=zeros(N,M,J);
for i=1:N
B=round(rand(1,M));%生成一个1M的向量,值为1表示m节点为用户i服务
for m=1:M
if(B(m)==1)
Mi(i,m)=1;
j=round(rand(1,1)
(J-1)+1);%B(m)=1表示i与m相连。此时为其分配一个任务j
Nmj(i,m,j)=1;
end
end
end
cvx_begin
variable a0(i);
variable am(i,m);
variable w0(i,m);
variable wc(i,m);
variable v(i,m);
obj_fun=0;%定义目标函数
for i=1:N
obj_fun=obj_fun+a0(i)*ki(i)*Fi(i)*Fi(i)*Req(i,1);
end
for i=1:N
for m=1:M
obj_fun=obj_fun+am(i,m)*n(i,m)*Req(i,2);
end
end
minimize(norm(obj_fun));

subject to
%con_17约束
for i=1:N
sum=0;
for m=1:M
sum=sum+Mi(i,m)*am(i,m);
end
sum=sum+a0(i);
sum==1;
end

%con_18约束
for i=1:N
for m=1:M
w0(i,m)+wc(i,m)-am(i,m)==0
end
end

%con_19约束

for m=1:N
a0(i)*lmd(i)*Req(i,2)<=SL(i);
end

%con_20约束

for m=1:M
sum=0;
for j=1:J
for i=1:N
if(Nmj(i,m,j)==1)
sum=sum+w0(i,m)*lmd(i)*S(j)
end
end
end
sum<=SE(m);
end

%con_21约束
A=1;%表示存在一个i
for m=1:M
sum=0;
for j=1:J
sum=sum+vimLU*w0(1,m)*J_req(j,1);
end
for j=1:J
for i=1:N
if(Nmj(i,m,j)==1)%表明我们找到了一个k
sum=sum+w0(i,m)*lmd(i)*J_req(j,1);
end
end
end
sum<=FEm(m);
end

% %con_22约束
%
% for i=1:N
% sum=a0(i)*Req(i,1)/Fi(i);
% for m=1:M
% A=lmd(i)am(i,m);
% D=1/Req(i,3);
% E=am(i,m)lmd(i);
% F=D-E;
% sum=sum+Mi(i,m)
(-1/lmd(i)+(lmd(i)/Req(i,3))
(1/(D-E))+inv_pos(v(i,m))+wc(i,m)*Req(i,4));
% end
% sum<=Req(i,5);
% end

%con_23约束
% Ci0=rand(1,N);%定义Ci0
for i=1:N
for m=0:M
if(m==0)
a0(i)*lmd(i)-Ci0(i)/Req(i,3)<=0;
else
am(i,m)*lmd(i)-1/Req(i,3)<=0;
end
end
end

%com_24约束
for i=1:N
H(1,1)<=a0(i)<=H(1,2);
for m=1:M
if(Mi(i,m)==1)
H(2,1)<=am(i,m)<=H(2,2);
end
end
end

%con_25、26、27约束
for i=1:N
for m=1:M
if(Mi(i,m)==1)
H(3,1)<=w0(i,m)<=H(3,2);
%w0(i,m)>=0;
H(4,1)<=wc(i,m)<=H(4,2);
%wc(i,m)>=0;
H(5,1)<v(i,m)<H(5,2);%待修改
end
end
end
cvx_end
obj_val=cvx_optval;
var_val=[a0,am,w0,wc,v];

%con_21检查,其实只需要检查con_21是否符合就行
A=1;%表示存在一个i
for m=1:M
sum=0;
for j=1:J
sum=sum+v(A,m)*w0(A,m)*J_req(j,1);
end
for j=1:J
for i=1:N
if(Nmj(i,m,j)==1)%表明我们找到了一个k
sum=sum+w0(i,m)*lmd(i)*J_req(j,1);
end
end
end
if(sum>FEm(m))%不符合约束返回0
check_val=0;
return;
end
end
check_val=1;%符合条件返回1
end