{"id":95,"date":"2008-08-05T01:32:47","date_gmt":"2008-08-05T06:32:47","guid":{"rendered":"http:\/\/www.circuitdesign.info\/?p=95"},"modified":"2020-11-02T20:38:16","modified_gmt":"2020-11-03T02:38:16","slug":"quantization","status":"publish","type":"post","link":"https:\/\/www.circuitdesign.info\/blog\/2008\/08\/quantization\/","title":{"rendered":"Quantization"},"content":{"rendered":"\n<p>I intend to explain a very powerful concept in data conversion: the Sigma-Delta loop. Before I do so, I will describe quantization noise (which sigma delta loops attempt to alleviate).<\/p>\n\n\n\n<p>Quantization noise occurs during the analog-to-digital conversion (ADC) process. Since an analog signal can attain any value, it has infinite precision. This infinite precision excludes the fact that all analog signals have some amount of circuit noise that limits their precision. On the other hand, digital signals are represented as 0s and 1s\u2014and a finite combination of them. As a result, during the conversion, we go from an infinite precision to a finite precision. The resulting error in this rounding is called quantization noise.<\/p>\n\n\n\n<p>We will analyze 3 examples of quantization, and analyze the noise both in the time domain and in the frequency domain.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Sampled Sinusoid<\/h2>\n\n\n\n<p>Our first example of quantization is that of an infinitely precise sinusoid. In this case, we are sampling this sinusoid at 16x its frequency. The sinusoid frequency is 1\/16 Hz. The sampling rate is 1 Hz. So, for every cycle of the sinusoid, we get 16 samples:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>time<\/td><td>sin(2*pi*t\/16)<\/td><td>Rounded (4-bit)<\/td><td>Error<\/td><\/tr><tr><td>0<\/td><td>0.00000<\/td><td>0.000<\/td><td>0.00000<\/td><\/tr><tr><td>1<\/td><td>0.38268<\/td><td>0.375<\/td><td>-0.00768<\/td><\/tr><tr><td>2<\/td><td>0.70711<\/td><td>0.750<\/td><td>0.04289<\/td><\/tr><tr><td>3<\/td><td>0.92388<\/td><td>0.875<\/td><td>-0.04888<\/td><\/tr><tr><td>4<\/td><td>1.00000<\/td><td>1.000<\/td><td>0.00000<\/td><\/tr><tr><td>5<\/td><td>0.92388<\/td><td>0.875<\/td><td>-0.04888<\/td><\/tr><tr><td>6<\/td><td>0.70711<\/td><td>0.750<\/td><td>0.04289<\/td><\/tr><tr><td>7<\/td><td>0.38268<\/td><td>0.375<\/td><td>-0.00768<\/td><\/tr><tr><td>8<\/td><td>0.00000<\/td><td>0.000<\/td><td>0.00000<\/td><\/tr><tr><td>9<\/td><td>-0.38268<\/td><td>-0.375<\/td><td>0.00768<\/td><\/tr><tr><td>10<\/td><td>-0.70711<\/td><td>-0.750<\/td><td>-0.04289<\/td><\/tr><tr><td>11<\/td><td>-0.92388<\/td><td>-0.875<\/td><td>0.04888<\/td><\/tr><tr><td>12<\/td><td>-1.00000<\/td><td>-1.000<\/td><td>0.00000<\/td><\/tr><tr><td>13<\/td><td>-0.92388<\/td><td>-0.875<\/td><td>0.04888<\/td><\/tr><tr><td>14<\/td><td>-0.70711<\/td><td>-0.750<\/td><td>-0.04289<\/td><\/tr><tr><td>15<\/td><td>-0.38268<\/td><td>-0.375<\/td><td>0.00768<\/td><\/tr><tr><td>16<\/td><td>0.00000<\/td><td>0.000<\/td><td>0.00000<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>The important thing to note is that the error (since it is solely dependent on the sinusoid) is periodic. It repeats every 16 samples. (In fact, it inverts itself every 8 samples.)<\/p>\n\n\n\n<p>This periodicity results in tones of the sinusoid in the spectral analysis of the samples:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"440\" src=\"https:\/\/www.circuitdesign.info\/blog\/wp-content\/uploads\/2008\/08\/scan0052.jpg\" alt=\"\" class=\"wp-image-89\" srcset=\"https:\/\/www.circuitdesign.info\/blog\/wp-content\/uploads\/2008\/08\/scan0052.jpg 640w, https:\/\/www.circuitdesign.info\/blog\/wp-content\/uploads\/2008\/08\/scan0052-300x206.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Sum of Four Prime Sinusoids<\/h2>\n\n\n\n<p>In this case, we sum 4 sinusoids, of frequency 1\/15 Hz, 1\/16 Hz, 1\/17 Hz, and 1\/19 Hz.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>Time<\/td><td>(sin(2*pi*t\/15)+sin(2*pi*t\/16)+sin(2*pi*t\/17)+sin(2*pi*t\/19))\/4<\/td><td>Rounding (4-bit)<\/td><td>Error<\/td><\/tr><tr><td>0<\/td><td>0.00000<\/td><td>0.000<\/td><td>0.00000<\/td><\/tr><tr><td>1<\/td><td>0.36884<\/td><td>0.375<\/td><td>0.00616<\/td><\/tr><tr><td>2<\/td><td>0.68454<\/td><td>0.625<\/td><td>-0.05954<\/td><\/tr><tr><td>3<\/td><td>0.90182<\/td><td>0.875<\/td><td>-0.02682<\/td><\/tr><tr><td>4<\/td><td>0.98991<\/td><td>1.000<\/td><td>0.01009<\/td><\/tr><tr><td>5<\/td><td>0.93708<\/td><td>0.875<\/td><td>-0.06208<\/td><\/tr><tr><td>6<\/td><td>0.75217<\/td><td>0.750<\/td><td>-0.00217<\/td><\/tr><tr><td>7<\/td><td>0.46319<\/td><td>0.500<\/td><td>0.03681<\/td><\/tr><tr><td>8<\/td><td>0.11295<\/td><td>0.125<\/td><td>0.01205<\/td><\/tr><tr><td>9<\/td><td>-0.24741<\/td><td>-0.250<\/td><td>-0.00259<\/td><\/tr><tr><td>10<\/td><td>-0.56604<\/td><td>-0.625<\/td><td>-0.05896<\/td><\/tr><tr><td>11<\/td><td>-0.79809<\/td><td>-0.750<\/td><td>0.04809<\/td><\/tr><tr><td>12<\/td><td>-0.91215<\/td><td>-0.875<\/td><td>0.03715<\/td><\/tr><tr><td>13<\/td><td>-0.89463<\/td><td>-0.875<\/td><td>0.01963<\/td><\/tr><tr><td>14<\/td><td>-0.75140<\/td><td>-0.750<\/td><td>0.00140<\/td><\/tr><tr><td>15<\/td><td>-0.50644<\/td><td>-0.500<\/td><td>0.00644<\/td><\/tr><tr><td>16<\/td><td>-0.19792<\/td><td>-0.250<\/td><td>-0.05208<\/td><\/tr><tr><td>17<\/td><td>0.12790<\/td><td>0.125<\/td><td>-0.00290<\/td><\/tr><tr><td>18<\/td><td>0.42368<\/td><td>0.375<\/td><td>-0.04868<\/td><\/tr><tr><td>19<\/td><td>0.64802<\/td><td>0.625<\/td><td>-0.02302<\/td><\/tr><tr><td>20<\/td><td>0.77147<\/td><td>0.750<\/td><td>-0.02147<\/td><\/tr><tr><td>21<\/td><td>0.78040<\/td><td>0.750<\/td><td>-0.03040<\/td><\/tr><tr><td>22<\/td><td>0.67850<\/td><td>0.625<\/td><td>-0.05350<\/td><\/tr><tr><td>23<\/td><td>0.48555<\/td><td>0.500<\/td><td>0.01445<\/td><\/tr><tr><td>24<\/td><td>0.23381<\/td><td>0.250<\/td><td>0.01619<\/td><\/tr><tr><td>25<\/td><td>-0.03730<\/td><td>0.000<\/td><td>0.03730<\/td><\/tr><tr><td>26<\/td><td>-0.28741<\/td><td>-0.250<\/td><td>0.03741<\/td><\/tr><tr><td>27<\/td><td>-0.48136<\/td><td>-0.500<\/td><td>-0.01864<\/td><\/tr><tr><td>28<\/td><td>-0.59414<\/td><td>-0.625<\/td><td>-0.03086<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>You\u2019ll notice that in this case, the quantization error does not repeat. It <em>will<\/em> repeat eventually (after 77520 samples)\u2014because that is when the input repeats. In our little observation window, things look random. The point of this example is that depending on the complexity of the input, the quantization noise can look random:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"453\" src=\"https:\/\/www.circuitdesign.info\/blog\/wp-content\/uploads\/2008\/08\/scan0052a.jpg\" alt=\"\" class=\"wp-image-91\" srcset=\"https:\/\/www.circuitdesign.info\/blog\/wp-content\/uploads\/2008\/08\/scan0052a.jpg 640w, https:\/\/www.circuitdesign.info\/blog\/wp-content\/uploads\/2008\/08\/scan0052a-300x212.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p>We don\u2019t merely see harmonics of each input\u2014we see complex inter-modulations of these tones. I dislike the term inter-modulation in this case since there are really no polynomial non-linearities in the quantizer. In fact, one cannot see any pattern to the resulting non-linearities: they are not stronger near the harmonics of the tones, exhibiting trailing side-bands that are characteristic of true inter-modulation.<\/p>\n\n\n\n<p>In fact, I often wonder as a circuit designer if our methods of applying a sinusoid and computing noise and distortion are overly conservative. Agreed, they give us insight in the workings of the circuits. But, do they accurately predict the behavior of the system for (say) CDMA or OFDM modulation on it? What if we add a GSM or VSB adjacent channel?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Sinusoid with Random Noise<\/h2>\n\n\n\n<p>Our final case is a sinusoidal input (such as in the first example) with added random noise to it.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>time<\/td><td>sin(2*pi*t\/16)+noise<\/td><td>Rounded (4-bit)<\/td><td>Error<\/td><\/tr><tr><td>0<\/td><td>0.15839<\/td><td>0.125<\/td><td>-0.03339<\/td><\/tr><tr><td>1<\/td><td>0.51863<\/td><td>0.500<\/td><td>-0.01863<\/td><\/tr><tr><td>2<\/td><td>0.76647<\/td><td>0.750<\/td><td>-0.01647<\/td><\/tr><tr><td>3<\/td><td>1.10245<\/td><td>1.125<\/td><td>0.02255<\/td><\/tr><tr><td>4<\/td><td>1.07941<\/td><td>1.125<\/td><td>0.04559<\/td><\/tr><tr><td>5<\/td><td>1.04485<\/td><td>1.000<\/td><td>-0.04485<\/td><\/tr><tr><td>6<\/td><td>0.81284<\/td><td>0.875<\/td><td>0.06216<\/td><\/tr><tr><td>7<\/td><td>0.48070<\/td><td>0.500<\/td><td>0.01930<\/td><\/tr><tr><td>8<\/td><td>0.15675<\/td><td>0.125<\/td><td>-0.03175<\/td><\/tr><tr><td>9<\/td><td>-0.23475<\/td><td>-0.250<\/td><td>-0.01525<\/td><\/tr><tr><td>10<\/td><td>-0.55725<\/td><td>-0.500<\/td><td>0.05725<\/td><\/tr><tr><td>11<\/td><td>-0.83914<\/td><td>-0.875<\/td><td>-0.03586<\/td><\/tr><tr><td>12<\/td><td>-0.84315<\/td><td>-0.875<\/td><td>-0.03185<\/td><\/tr><tr><td>13<\/td><td>-0.80978<\/td><td>-0.750<\/td><td>0.05978<\/td><\/tr><tr><td>14<\/td><td>-0.69691<\/td><td>-0.750<\/td><td>-0.05309<\/td><\/tr><tr><td>15<\/td><td>-0.33005<\/td><td>-0.375<\/td><td>-0.04495<\/td><\/tr><tr><td>16<\/td><td>0.13032<\/td><td>0.125<\/td><td>-0.00532<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>I have chosen the noise to be large enough to overwhelm the input. In this case, the error no longer looks periodic. Its statistics are basically dictated by the noise, not the signal.<\/p>\n\n\n\n<p>In this case, there is no tonal quality to the quantization noise\u2014not even over large periods of observation (in contrast to the previous example). In fact, this method of adding noise (called dither) is often used in audio equipment, since audiophiles have a larger aversion to tonal distortion than to random noise.<\/p>\n\n\n\n<p>There\u2019s no free lunch here. The overall spectrum exhibits more total error (the added dither plus the quantization noise) than in the first example\u2014we have improved the quality of the overall noise, but not the quantity:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"458\" src=\"https:\/\/www.circuitdesign.info\/blog\/wp-content\/uploads\/2008\/08\/scan0053.jpg\" alt=\"\" class=\"wp-image-93\" srcset=\"https:\/\/www.circuitdesign.info\/blog\/wp-content\/uploads\/2008\/08\/scan0053.jpg 640w, https:\/\/www.circuitdesign.info\/blog\/wp-content\/uploads\/2008\/08\/scan0053-300x214.jpg 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p>In contrast, the sigma-delta loop randomizes noise by introducing a chaotic memory element. I will explain the sigma-delta in detail in the future posts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I intend to explain a very powerful concept in data conversion: the Sigma-Delta loop. Before I do so, I will describe quantization noise (which sigma delta loops attempt to alleviate). Quantization noise occurs during the analog-to-digital conversion (ADC) process. Since an analog signal can attain any value, it has infinite precision. This infinite precision excludes [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-95","post","type-post","status-publish","format-standard","hentry","category-analog-pro"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/poCEy-1x","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.circuitdesign.info\/blog\/wp-json\/wp\/v2\/posts\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.circuitdesign.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.circuitdesign.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.circuitdesign.info\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.circuitdesign.info\/blog\/wp-json\/wp\/v2\/comments?post=95"}],"version-history":[{"count":6,"href":"https:\/\/www.circuitdesign.info\/blog\/wp-json\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":1194,"href":"https:\/\/www.circuitdesign.info\/blog\/wp-json\/wp\/v2\/posts\/95\/revisions\/1194"}],"wp:attachment":[{"href":"https:\/\/www.circuitdesign.info\/blog\/wp-json\/wp\/v2\/media?parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.circuitdesign.info\/blog\/wp-json\/wp\/v2\/categories?post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.circuitdesign.info\/blog\/wp-json\/wp\/v2\/tags?post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}