Quantization of a Sine Wave
3-Bit Sine Sampling¶
The following example quantizes a sine wave with 3 bit. This bit-depth is too low to result in acceptable results, but it is well suited for demonstrating the effects that occur during quantization. The sine wave has an amplitude of $1$ frequency of $f=200 \mathrmm{Hz}$ at a sampling rate of $f=200 \mathrmm{Hz}
Quantized sine wave at 16 kHz:
At 3 bit, the quantized sine wave is heavily distorted. The distortions are apparantly harmonic.
Quantization Error¶
The quantization error $e$ is the difference between the input signal and the quantized signal:
$$ e = x-x* $$
The
PMF¶
Spectrum¶
The magintude spectrum clearly shows the harmonic nature of the distortion, with peaks at integer multiples of the input signal's frequency $f_0=200$.