function y = minfun(x)
y = abs(binary(x)-ternary(x));
