# Quantization Error and SNR

In earlier posts, we had a glimpse of the term quantization error. This error is introduced during the quantization process in the due course of conversion. The process of quantizing is equivalent to rounding up or truncation of a number. Incase of analog converters, it is the rounding up/truncation of the analog signal to a digital value the ADC can output (or encode). This process of approximation introduces an error called the quantization error into the readings. It other words the errored output is the result of infestation (superimposition) of quantization noise on the input signal.

### Compensated and Uncompensated Quantization

Continuing with the simple example of a 3-bit ADC from previous posts, an analog input of zero produces an output code of zero (000). As the input voltage increases towards Vref/8, the error also increases because the input is no longer zero, but the output code remains at zero because a range of input voltages is represented by a single output code. When the input reaches Vref/8, the output code changes from  000 to 001, where the output exactly represents the input voltage and the error reduces to zero. As the input voltage increases past Vref/8, the error again increases until the input voltage reaches Vref/4, where the error again drops to zero. This process continues through the entire input range and the error plot is a saw tooth, as shown below.

The maximum error we have here is 1LSB. This type of quantization method is called Uncompensated Quantization — The first step is taken at 1LSB, with each successive step taken at 1LSB intervals and the last step taken at VRef+ – 1LSB. Uncompensated Quantization is similar to truncation.

This 0 to 1 LSB range is known as the “quantization uncertainty” because we cannot determine with certainty what input signal would have cause the obtained digital output. This uncertainty results from the finite resolution of the ADC. That is, the ADC can only resolve the input into 2n discrete values. Each output code represents a range of input values. This range of values is a quanta. The converter resolution, then, is 2n. So, for an 8 Volt reference (with a unity gain factor), a 3-bit converter resolves the input into Vref/8 = 8V/8 = 1 Volt steps.

But an error of 0 to 1 LSB is not as desirable as is an error of ±½ LSB, so we introduce an offset into the A/D converter to force an error range of ±½ LSB. This type of quantization method is called ½ LSB Compensated Quantization – The first step is taken at ½ LSB, with each successive step taken at 1 LSB intervals and the last step taken at VRef+ – 1½ LSB. Compensated Quantization is similar to rounding.

The discussion of ADC always involves the relationship of the input with the  output. So we can look at the same concept with the perspective of a transfer function. The transfer function of a system is a mathematical function relating the output or response of a system to the input or stimulus.

The Ideal Transfer Function of an ADC is a straight line from the minimum input voltage (voltage reference low; VRef-) to the maximum input voltage (voltage reference high; VRef+). The Ideal Transfer Function is then quantized (divided into steps) by the number of codes the ADC is capable of resolving. The input voltage range is divided into steps, each step having the same width.

## RMS value of Quantization Noise

Probability density function (PDF) for quantization error is uniformly distributed i.e. any value of the error is equally likely, so it has a uniform distribution ranging from −Q to +Q. Here Q or quantum is a range of input values that produces the same output. It is equivalent to the Least Significant Bit (LSB).

Then, this error can be considered a quantization noise with RMS value Vqn with its value as,

## Frequency spectrum of the quantization noise

The quantization noise power is given by Vqn2, but where is it located or concentrated in the frequency domain? The quantization error creates harmonics in the signal that extend well above the Nyquist frequency (½ of sampling frequency). Due to the sampling step of an ADC, these harmonics get folded to the Nyquist band, pushing the total noise power into the Nyquist band and with an approximately white spectrum (equally spread across all frequencies in the band).

## Signal to Quantization Noise Ratio (SQNR)

Signal to Noise Ratio (SNR) is the ratio of the output signal amplitude to the output noise level, not including harmonics or DC. Obviously, for any system, low noise is desirable, so achieving a greater SNR value is advisable.

For example, a signal level of 1 Vrms and a noise level of 100 μVrms yields an SNR of 104 or 80dB. The noise level is integrated over half the clock frequency.

When the noise in the discussion is quantization noise, SNR can be termed as SQNR or Signal to Quantization Noise Ratio. For ADCs, the amplitude of the quantization noise decreases as resolution increases because the size of an LSB (or Q) is smaller at higher resolutions, which reduces the maximum quantization error. The theoretical ‘maximum’ Signal to Quantization Noise Ratio for an ADC with a full-scale sine-wave input can be derived as follows:

Assuming an input sinusoidal with peak-to-peak amplitude Vref, where Vref is the reference voltage of an n-bit ADC (therefore, occupying the full-scale of the ADC), its RMS value is,

substituting the value of Vrms and Vqn in the formula for SNR, we get:

In fact, this equation generalizes to any system using a digital representation. So, a microprocessor representing values with n bits will have a maximum SQNR defined by the above formula. This is how the SQNR is related to the number of bits.

## SQNR characteristics

SQNR increases at the same rate as the input amplitude until the input gets close to full scale. That is, increasing the input signal amplitude by 1 dB will cause a 1 dB increase in SQNR. This is because the step size becomes a smaller part of the total signal amplitude as the signal amplitude increases. For a realistic converter, when the input amplitude starts approaching full scale, the rate of increase of SQNR with respect to input signal decreases.

Also, SQNR performance decreases at higher frequencies because the effects of jitter.

## One thought on “Quantization Error and SNR”

1. Very good article. I certainly love this site.
Stick with it!