Sub-step estimation with uniform dither (source code)

= Sub-step estimation with uniform dither
{title2=$\operatorname{Var}(\overline Q)=f(1-f)\Delta^2/N$}

Let a constant input be $x=(k+f)\Delta$ with $0\leq f\leq1$, between consecutive <quantization (signal processing)> levels $k\Delta$ and $(k+1)\Delta$. Add independent centered uniform <dither> $U\sim\operatorname{Uniform}[-\Delta/2,\Delta/2]$ before nearest-level <rounding>, and assume that neither code clips.

The upper code is selected exactly when $U\geq(1/2-f)\Delta$. This subinterval occupies fraction $f$ of the <uniform distribution>'s support, so $Q=k\Delta+\Delta B$ with $B$ a <Bernoulli random variable> of parameter $f$. Thus $\mathbb E[Q]=x$ and $\operatorname{Var}(Q)=f(1-f)\Delta^2$. Averaging $N$ independent conversions gives
$$
\operatorname{Var}(\overline Q)=\frac{f(1-f)\Delta^2}{N}.
$$
For example, an input one quarter of a step above the lower code produces the upper code one quarter of the time. Its averaged code can estimate a sub-step <voltage>, with a finite remaining <variance>. Centering, independence and absence of clipping are assumptions of this calculation; a shifted <dither> distribution can bias the result.