# How does the quantization error generate noise?

I'm learning about sampling and DSP on my own. I have a hard time to understand how the quantization error results in noise. I think I miss a fundamental understanding but can't tell what it is. So how does the quantization error generate noise?

-
It's more distortion than noise. It depends on the signal, and is not random. –  endolith Jul 15 '12 at 20:48
endolith, I think what I don't understand is how the error results in frequencies. –  Fair Dinkum Thinkum Jul 15 '12 at 21:04
distortion always produces additional frequencies. if you distort a sine wave, it becomes a different repetitive waveform. any repetitive waveform other than a sine wave is made up of multiple frequencies. –  endolith Jul 15 '12 at 22:58
As @endolith has mentioned, let us assume you have a very bad ADC, such that you give it a pure tone, but get a signal that looks like a sine but has big steps in it. (So now your signal looks like a staircase that is going up and down with the original sine.) Now, you know intuitively that a step is composed of many frequencies. This is how an ADC will add frequencies as you are asking. It is a non-linear operation btw. If it was linear, you could not make new frequencies, only superimpose many of them together. –  Mohammad Jul 16 '12 at 14:33

Suppose I have a multitone signal (six carriers, at ±1/1000, ±2/1000 and ±7/1000 of sampling frequency)

x = (1:1000);
wave = sin(x/1000*2*pi) + sin(x/1000*2*pi*2) + sin(x/1000*2*pi*7);


which is quantized using a 14-bit ADC

wave_quant = round(wave * 16384) / 16384;


The difference

wave_qnoise = wave_quant - wave;


gives the quantization error

The corresponding spectrum

wave_qnoise_freq = mag(fftshift(fft(wave_qnoise)) / sqrt(1000));


shows the generated noise floor across the entire spectrum.

This assumes that the quantization error does not introduce a bias. If the ADC always chooses the lower value

wave_quant_biased = floor(wave * 16384) / 16384;


we get a quantization error that is no longer centered around zero

wave_qnoise_biased = wave_quant_biased - wave;


which has a definite spike in the FFT in the DC bin

wave_qnoise_biased_freq = mag(fftshift(fft(wave_qnoise_biased)) / sqrt(1000));


This becomes a real problem with e.g. Quadrature Amplitude Modulation, where a DC offset in the demodulated signal corresponds to a sine wave at the demodulation frequency.

-
This is very great thank you for your help. this way i have explored the distortion related to the quantization. –  user3314 Nov 20 '12 at 6:37

"Noise" in this context refers to anything unwanted added to the signal, it doesn't necessarily mean it is gaussian noise, white noise, or any random well-described process.

In the context of quantization, it is a purely algebraic argument. One can view quantization as the addition of an unwanted signal ("noise") equal to... the difference between the original signal and the quantized signal. Note that this quantification noise is not random, and is correlated with the input signal. For example, if a signal is periodic, the quantization noise introduced when quantizing it will be periodic too.

-
I think I understood how the quantization causes the error itself. What puzzles me is how it generates frequency. My understanding is: "Unwanted signal" means unwanted frequencies. Suppose I sample a pure sinusoidal signal. Then the quantization error introduces "overtones". I suppose the overtones originate from the "staircase" shape of the sampled signal. Is that correct? –  Fair Dinkum Thinkum Jul 15 '12 at 20:44
@FairDinkumThinkum: yes, if you distort a pure sine wave, you will get harmonic distortion, which produces new frequencies at multiples of your sine wave's frequency. en.wikipedia.org/wiki/Distortion#Harmonic_distortion –  endolith Jul 15 '12 at 22:59

To expand on what pichenettes said, consider if you have an audio signal that is being digitized by a D-to-A converter that only has a resolution of 0.01 volt. If, at some particular instant in time, the audio signal is at 7.3269 volts, that will be either rounded to 7.33 volts or truncated to 7.32 volts (depending on the design of the converter). In the first case you've added "noise" of 7.33-7.3269 volts, or 0.0031 volt. In the second case you've added "noise" of 7.32-7.3269 volts, or -0.0069 volt.

Of course, there is additional noise added due to the fact that the converter is most certainly not infinitely accurate, and probably has an accuracy on par with its precision.

-