# Invalid constraint: {constant} <= {convex}

I get an error for this code
and I use slack variable

``````cvx_begin
variable Q_new(N,2)
gama0 = P * db2pow(row0) / sigma2;
expression R(K,1);
for i = 1 :1: K
for n = 1:1: N
r = r + a(n,i) * ( (-gama0 * log2(exp(1)))/(H^2 + sum_square_abs(Q(n)-X(i,:)))/...
(H^2 +  sum_square_abs(Q(n)-X(i,:)) + gama0) *...
( sum_square_abs(Q_new(n)-X(i,:))- sum_square_abs(Q(n)-X(i,:)) )...
+ log2(1 + gama0/(H^2+ sum_square_abs(Q(n)-X(i,:)))) );
end
R(i) = r;
end
expression eta_lb
maximize eta_lb
subject to
for i = 1:K
eta <= R (i);
R (i) >= eta
end
norms(Q_new(2:N)-Q(1:N-1),2,2) <= Smax^2 ;
Q_new(1) == Q_new(N);
cvx_end
``````

error is

``````Error using cvxprob/newcnstr (line 192)
Disciplined convex programming error:
Invalid constraint: {constant} <= {convex}

Error in  <=  (line 21)
b = newcnstr( evalin( 'caller', 'cvx_problem', '[]' ), x, y, '<=' );

Error in main (line 133)
eta <= R (i);``````

Nonlinear equality constraints are non-convex. Your attempt to commit “convex alchemy” by writing a nonlinear equality as two inequalities does not convexify the constraint, because as you have seen, at least one, and in your case, exactly one of the two constraints must be non-convex.