% constantness
% byaverage( Matrice, i, j)

function cons = byaverage(A,i,j)
moy = @moyenne;
m = feval(moy,A, i, j);
cons = (A(i,j)-m)^(2)+(A(i+1,j)-m)^(2)+(A(i,j+1)-m)^(2)+(A(i+1,j+1)-m)^(2);