EE3414 Homework #3 Solution 1. Determine and illustrate the partition levels and reconstruction levels of a uniform quantizer in the range of (-1, 1) with 4 levels. Solution: The entire data range is -1+1=2 N=4, Q=2/4=0.5 The partition and reconstruction levels are illustrated below. -0.75 Reconstruction levels Partition levels -0.5 -1.0 0.75 0.25 -0.25 0 0.5 2. For the sequence {0.2,-0.3,-0.7, 0.8,}, a. Determine the quantized sequence using the uniform quantizer of Prob. 1. Also determine the mean square quantization error and SNR. b. Determine the binary stream corresponding to the quantized sequence. Solution: a. The quantized sequence is {0.25, -0.25, -0.75, 0.75}. The quantization error is q2 1 N ( x(n) xˆ(n)) 2 n 1 ((0.2 0.25)^ 2 (0.3 0.25)^ 2 (0.7 0.75)^ 2 (0.8 0.75)^ 2) 0.0025 4 To determine the SNR, we need to first determine the variance of the signal from the given samples. First we need to determine the mean value of the original samples: Mean=(0.2-0.3-0.7+0.8)/4=0.0 x2 1 N ( x(n) mean)) 2 n 1 ((0.2)^ 2 (0.3)^ 2 (0.7)^ 2 (0.8)^ 2) 0.3125 4 2 SNR 10 log 10 x 2 10 log 10 0.3125 20.97dB 0.0025 q b. {10, 01, 00, 11} 1.0 There are 4 quantized levels, so we need 2 bits to represent each. The above solution is based on the following mapping of quantized levels to codewords: -0.75 -> “00”, -0.25 ->”01”, 0.25->”10”, 0.75->”11”. 3. Determine and illustrate the partition levels and reconstruction levels of a µ-law quantizer in the range of (-1, 1) with 4 levels, µ =16. Solution: We need to apply the inverse µ-law mapping to the partition and reconstruction levels for the uniform quantizer to obtain the partition and reconstruction levels for the µ-law quantizer. Because of the symmetry of the quantizer, we only need to determine the mapped values for 0.25, 0.5, 0.75. Using the inverse µ-law formula log(1 ) y X max x F [ y ] 10 X max 1 sign(y) 1 with µ =16, xmax=1, we obtain 0.25->0.06, 0.5->0.1958, 0.75->0.46. -0.46 -1.0 -0.06 0.06 -0.20 0 0.46 0.20 1.0 4. For the same sequence as in Problem 2, a. Determine the quantized sequence using the µ -law quantizer of Prob. 3 b. Determine the binary stream corresponding to the quantized sequence. Solution a. The original sequence {0.2,-0.3,-0.7, 0.8,} The quantized sequence {0.46,-0.46,-0.46, 0.46} The quantization error is 1 4 q2 ((0.2 0.46)^ 2 (0.3 0.46)^ 2 (0.7 0.46)^ 2 (0.8 0.46)^ 2) 0.0666 2 SNR 10 log 10 x 2 10 log 10 0.3125 6.71dB 0.0666 q For this small numerical example, mu-law quantizer is not very good. This is because the given sequence is very short, has equal number of small and large values. Also, mulaw quantizer is targted to maximize perceptual quality rather than minimizing the mean square error or maximizing the SNR. b. The binary stream corresponding to the quantized sequence is {11, 00, 00, 11}