Square_pos not is a suqare

%0-1 inter

clc,clear;
close all;

N = 10;
M=6;
A = rand(N);
A =(A*A’);
A = (A+A’)/2;

% x0 = [ones(M,1);zeros(N-M,1)];
rho=0.1;

cvx_begin
variable x(N,1)
variable x1(N,1)
minimize (x’Ax+rho*(square_pos(norm(x.*(1-x1),2))+square_pos(norm(x-x1,2))))
subject to
for ii=1:N
x(ii)>=0;
x(ii)<=1;
x1(ii)>=0;
x1(ii)<=1;
end
sum(x)==M
cvx_end

Here you have norm of an expression that is not affine.

i realize the expression is not convex, is this causes the error in cvx?

Yes, that causes an error in CVX. Please carefully read