Quantization

# Quantization

## Quantization

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. Quantization

2. Does the digital representation of an analog value have anything to do with the digital filtering process? Digital representations of analog signals are in the form of bits. These bits are taken from an analog-to-digital converter, processed and then put to a digital-to-analog converter. bits x y A/D Filtering D/A bits

3. Up until this point we have been dealing with sampled analog functions, where each sample is represented by a real number. A real number cannot be represented with complete accuracy. The samples are represented (in a computer) by a finite number of bits representing the number as an integer or a floating-point number. We determined the number of samples per second that was needed to accurately represent the analog signal. We will now consider the number of bits needed per sample to accurately represent the analog signal.

4. WithB bits, we can represent 2B different values. For example, if B=3, we can have eight different values corresponding to 000, 001, 010, 011, 100, 101, 110, 111. The 2B values can correspond to volts, millivolts, multiplies of 0.25 volts, etc.

5. Example: Suppose we had B=3 bits corresponding to a number which is equal to the voltage of a signal (at some point in time). The 23=8 different voltage levels are 0V, 1V, 2V, 3V, 4V, 5V, 6V and 7V. A digital-to-analog converter would convert 000 to 0V, 001 to 1V, etc. An analog-to-digital converter would convert an input signal at 0V to 000. An input of 1V would be converted to 001; an input of 2V would be converted to 010, etc.

6. Suppose the input signal to an analog-to-digital converter were 1.5V. Would this voltage be converted to 001 or 010? The answer depends upon the type of quantization used by the analog-to-digital converter. If the type of quantization is truncation, then allvalues from 1.0V up to but not including 2.0V are converted to 001. If the type of quantization is rounding, then allvalues from 0.5V up to but not including 1.5V are converted to 001. Values of from 1.5V up to but not including 2.5V are converted to 010.

7. ^ Let xbe the quantized version of x. While x can take on any value, x can only take on discrete values corresponding to the output of a digital-to-analog converter such as 1.0, 2.0, 3.0 (volts). ^ If we cascade an analog-to-digital converter with a digital-to-analog converter we will get a quantizer that converts x to x. ^ 000, 001, … ^ x x A/D D/A

8. ^ The relationships between x and x are shown on the following graphs.

9. ^ x Truncation 111 7 110 6 101 5 100 4 011 3 010 2 001 1 000 x 1 2 3 4 5 6 7 8

10. ^ x Rounding 7 6 5 4 3 2 1 x 1 2 3 4 5 6 7 8

11. Negative values can also be represented digitally. There are two common formats: sign magnitude and two’s complement. In sign magnitude format, the most significant bit is a sign bit:1 is negative,0 is positive. In two’s complement format, positive numbers are like normal positive numbers. Negative numbers are wrapped backwards: -1 is 111, -2 is 110, etc.

12. Shown on the following graphs are signed quantization levels and values for truncation and rounding quantization, and sign magnitude and two’s complement formats.

13. ^ x Truncation, Sign Magnitude 011 010 001 x 000 101 110 111

14. ^ x Truncation, Two’s Complement 011 010 001 x 000 111 110 101 100

15. ^ x Rounding, Sign Magnitude 011 010 001 x 000 101 110 111

16. ^ x Rounding, Two’s Complement 011 010 001 x 000 111 110 101 100

17. In all of the previous quantization examples, the step size was one (1). The step size could be 0.5, 0.25, etc. Let D be the step size, also known as the quantization interval. For truncation quantization, the quantization error is between 0 and D. For rounding quantization, the quantization error is between -D/2 and +D/2.

18. The ratio of the maximum signal magnitude to the quantization interval is a measure of the fidelity of the digitized sample. Let us see if we can relate this ratio to a more common ratio called the signal-to-noise ratio (SNR). Let A be the maximum magnitude of a signal. The ratio of the maximum magnitude to the quantization interval is A/D. The signal-to-noise ratio is a ratio of powers. The power in a signal is related to its distribution.

19. If the signal is uniformlydistributed between –A and A, the distribution looks like this: px(x) x -A A

20. In many cases, we can assume that the distribution of the quantization error, e, is uniform: pe(e) Truncation e D

21. In many cases, we can assume that the distribution of the quantization error, e, is uniform: pe(e) Rounding e -D/2 D/2

22. The power may be obtained from a distribution by integrating the product of the distribution with x2 or e2.

23. For truncation quantization we have

24. For rounding quantization we have

25. We can now calculate the signal-to-noise ratio for a uniformly distributed signal with truncation and rounding quantization:

26. Exercise: If we use B-bit quantization (with 2B quantization levels), express the signal-to-noise ratio in dB [=10 log (power ratio)] in terms of Bfor both truncation and rounding quantization. (In both cases, 2A/D = 2B.)

27. Error or distortion due to quantization has an effect on the signal. Quantization error also has an effect on the filtering process.

28. Example: Consider the following filter (transfer function): Suppose we apply a pulse x[n]=d[n] to this filter. The expected response is y[n] = (0.75)n.

29. Now suppose we introduce quantization into the arithmetic. Let B=3, or q=1/8. The result is as follows:

30. The quantized output does not go to zero: it levels-off at a final value of y[n] = 0.25. The resultant “leveling-off” effect is called the deadband effect. The result gets even worse as the poles get close to the unit circle. Suppose we modified the previous example to change the location of the pole from z=0.75 to z=0.875.

31. The results for the impulse response are shown on the following slides in tabular and graphic form.

32. Exercise: Find the impulse response to the following filter: Use three-bit quantization, then try four-bit quantization.

33. Let us generalize this quantization problem in filtering. In our previous examples we had a filter function of the form

34. The corresponding difference equation is This operation needs to be performed for each input sample (and output sample). The quantization error occurs in the multiplication of a and y[n-1].

35. Since this error occurs for each sample, the error is compounded by repeated calculations. To see the final, net effect of this error, let us look at the final, steady-state value of ŷ[n] which we will denote by ŷf

36. The final value of y[n]without any quantization error is

37. The net error is

38. For rounding truncation, So, the net error would have the following range:

39. This idea can be extended to a general filter expressed as a polynomial fraction: We will have

40. Example: Use the derived relationship on the bounds of the final error for each of the following filters:

41. The net error due to quantization and filtering is also dependent upon the order and manner in which the filter operations are performed. As an example, consider the following filter

42. We can also implement this filter as The corresponding difference equation is

43. We can also implement this filter as This can be thought of as a compoundfilter: