 # How to constrain a element of variable

I defind a variable with dimension 1*n,But i want to constrain the first element and the last element of the variable,to make the two elements larger than maximization of the variable, so how should i do？Is this can achieve?

the code:
cvx_begin quiet
variable wt(Mt-2) complex %variable
minimize(norm(cur_Qt*wt,1));
subject to
At_tar’*wt == 1;
abs(wt(1)) >= max(abs(wt))*0.0001; %%canstrain the first element of the variable
abs(wt(end)) >= max(abs(wt))*0.0001; %%canstrain the first element of the variable
for sl=1:length(sl_ind)
abs(Ats(:,sl)’*wt) <= 10^(desired_psll/20);
end
cvx_end

error:
error using cvxprob/newcnstr (line 192)
Disciplined convex programming error:
Invalid constraint: {convex} >= {real constant}

error >= (line 21)
b = newcnstr( evalin( ‘caller’, ‘cvx_problem’, ‘[]’ ), x, y, ‘>=’ );

`convex >= constant` is a non-convex constraint; therefore, not allowed by CVX. If you want abs(cvx variable) >= constant, you would need to introduce binary variables to handle this non-convex use of the convex function `abs`. You can search at https://or.stackexchange.com/ and ask for help there on how to do that. You will need to have Gutobi or Mosek available as solver to do this in CVX.

Thanks, do you have other simply methods that i can constrain the first element of the varible made it larger than the maxization of the variable?
like: abs(wt(1)) >= max(abs(wt))*0.0001;

You are using `abs` in a non-convex manner, hence the need for binary variables to handle the non-convexity.

so i should redefind binary variable or transform variable into binary version,please tell me how to do? I’m not familar with it.

AS I wrote, please seek assistance at https://or.stackexchange.com/ .Ask how to convert this to a convex constraint using binary variables.