{"id":693,"date":"2017-08-17T18:39:39","date_gmt":"2017-08-18T01:39:39","guid":{"rendered":"http:\/\/www.earlevel.com\/main\/?p=693"},"modified":"2019-02-24T15:15:12","modified_gmt":"2019-02-24T23:15:12","slug":"sampling-theory-the-best-explanation-youve-ever-heard-part-2","status":"publish","type":"post","link":"https:\/\/www.earlevel.com\/main\/2017\/08\/17\/sampling-theory-the-best-explanation-youve-ever-heard-part-2\/","title":{"rendered":"Sampling theory, the best explanation you\u2019ve ever heard\u2014Part 2"},"content":{"rendered":"<p><em>In this article, we explore the origins of sampling.<\/em><\/p>\n<h3>Discrete time<\/h3>\n<p>For many, discrete time and digital sampling are synonymous, because most people have little experience with discrete time analog. But perhaps you\u2019ve used an old-style analog delay stompbox, with \u201cbucket brigade\u201d delay chips. Discrete time goes back a lot farther, though. When we talk of the sampling theorem, attributed to people like Nyquist, Shannon, and others, it applies to discrete time signals, not digital signals in particular.<\/p>\n<p>The origins of discrete time theory are in communications. A single wire can support multiple simultaneous telegraph messages, if you synchronize a commutator between sender and receiver and slice time into sections to interleave the messages\u2014this is called Time Division Multiplexing, or TDM. Following later with voice, using TDM to fit multiple voice calls on a line, it was found that the sampling rate had to be around 3500-4300 Hz for satisfactory results.<\/p>\n<p>Traveling over a wire, analog signals can\u2019t be \u201cdiscrete\u201d per se\u2013there is always something being sent, no gaps in time. But the signal information is discrete, sending zero in between, and that leaves room to interleave other signals in TDM.<\/p>\n<p><a href=\"\/main\/wp-content\/uploads\/2017\/08\/TDM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-686\" src=\"\/main\/wp-content\/uploads\/2017\/08\/TDM.png\" alt=\"\" width=\"460\" height=\"80\" srcset=\"https:\/\/www.earlevel.com\/main\/wp-content\/uploads\/2017\/08\/TDM.png 460w, https:\/\/www.earlevel.com\/main\/wp-content\/uploads\/2017\/08\/TDM-300x52.png 300w\" sizes=\"(max-width: 460px) 100vw, 460px\" \/><\/a><\/p>\n<p>The most common method of making an analog signal discrete in this way is through Pulse Amplitude Modulation, or PAM. This means we multiply the source signal continuously with a pulse train of unit amplitude.<\/p>\n<p><a href=\"\/main\/wp-content\/uploads\/2017\/08\/Sampling.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-687\" src=\"\/main\/wp-content\/uploads\/2017\/08\/Sampling.png\" alt=\"\" width=\"640\" height=\"140\" srcset=\"https:\/\/www.earlevel.com\/main\/wp-content\/uploads\/2017\/08\/Sampling.png 640w, https:\/\/www.earlevel.com\/main\/wp-content\/uploads\/2017\/08\/Sampling-300x66.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>While the benefit of PAM for analog communications is that we can interleave multiple signals, for digital, the benefit is that we don\u2019t need to store the \u201cblank\u201d (zero) space between samples. For digital sampling, we simply measure the height of each impulse of the PAM result, and encode it as a number. Pulse Amplitude Modulation and encoding\u2014we call the combined process Pulse Code Modulation. Now you know what PCM means.<\/p>\n<h3>Impulses, really<\/h3>\n<p>Some might look at that last diagram and think, \u201cBut I\u2019ve seen this process depicted as a staircase wave before, not spiky impulses.\u201d In fact, measuring voltage quickly and with precision, which we must do for the encoding step, is not easy. Fortunately, we intend to discard the PAM waveform anyway, and keep just the digital values. We don\u2019t need to maintain the empty spaces between impulses, since our objective is not time division multiplexing analog signals. So, we perform a \u201csample and hold\u201d process on the source signal, which charges a capacitor at the moment of sampling and stretches the voltage value out, allowing a more leisurely measurement.<\/p>\n<p><a href=\"\/main\/wp-content\/uploads\/2017\/08\/SH.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-688\" src=\"\/main\/wp-content\/uploads\/2017\/08\/SH.png\" alt=\"\" width=\"640\" height=\"132\" srcset=\"https:\/\/www.earlevel.com\/main\/wp-content\/uploads\/2017\/08\/SH.png 640w, https:\/\/www.earlevel.com\/main\/wp-content\/uploads\/2017\/08\/SH-300x62.png 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>This results only in a small shift in time, functionally identical to instantaneous sampling\u2014digital samples represent impulses, not a staircase. If you have a sample value of 0.73, think of it as an impulse of height 0.73 units.<\/p>\n<p>The step of digitizing the analog PAM signal introduces quantization, and therefore quantization error. But it\u2019s important to understand that issues related to aliasing are not a property of the digital domain\u2014aliasing is a property of discrete time systems, so is inherent in the analog PAM signal as well. That\u2019s why we took this detour\u2014I believe I can explain aliasing to you in a simpler way, from the analog perspective.<\/p>\n<p><em>Next: We&#8217;ll look at exactly what frequency content is added by the PAM (and therefore PCM) process, in Part 3<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we explore the origins of sampling. Discrete time For many, discrete time and digital sampling are synonymous, because most people have little experience with discrete time analog. But perhaps you\u2019ve used an old-style analog delay stompbox, with &hellip; <a href=\"https:\/\/www.earlevel.com\/main\/2017\/08\/17\/sampling-theory-the-best-explanation-youve-ever-heard-part-2\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,7],"tags":[37],"_links":{"self":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/693"}],"collection":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/comments?post=693"}],"version-history":[{"count":5,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/693\/revisions"}],"predecessor-version":[{"id":840,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/693\/revisions\/840"}],"wp:attachment":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/media?parent=693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/categories?post=693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/tags?post=693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}