B = 12;                   % number of bits
range = 2^(B-1) - 1;
th = -range:range;       % thresholds (ideal converter)
% th(20) = th(20)+0.7;
% th = th + 0.5*randn(1, length(th));

fs = 1e6;
fx = 494e3 + pi;
C  = round(100 * 2^B / (fs / fx));

t = 0:1/fs:C/fx;
x = (range+1) * sin(2*pi*fx.*t);
y = adc(x, th) - 2^(B-1);

hist(y, min(y):max(y));

dnl_inl_sin(y);
