1 00:00:00,012 --> 00:00:04,812 So in this video, we're finally going to get the signal into the computer. 2 00:00:04,812 --> 00:00:09,487 We've talked about how numbers are represented by computers, but now we have 3 00:00:09,487 --> 00:00:13,437 to figure out how we actually convert an analog signal, like a voltage into a 4 00:00:13,437 --> 00:00:17,887 number that goes into a computer. This is called Analog-to-Digital 5 00:00:17,887 --> 00:00:21,952 Conversion. And I think the name is pretty obvious. 6 00:00:21,952 --> 00:00:27,225 We'll go through the details of that. It actually goes through two stages. 7 00:00:27,225 --> 00:00:31,446 One is to acquire values of the signal at various times. 8 00:00:31,446 --> 00:00:37,405 we'll learn that there's something called the sampling theorem, very important 9 00:00:37,405 --> 00:00:42,857 result in this business in which you can sample a signal without error. 10 00:00:42,857 --> 00:00:48,357 Amplitude quantization is another story. Now, we have to convert those continuous 11 00:00:48,357 --> 00:00:53,482 amplitude values, characteristic of analog signals, into a set of discreet 12 00:00:53,482 --> 00:00:56,532 values. That incurs error, as we'll see, and 13 00:00:56,532 --> 00:01:00,112 we'll learn how to analyze and control those errors. 14 00:01:00,112 --> 00:01:06,873 Alright. So, let's go over the definition again of an analog an a digital signal. 15 00:01:06,873 --> 00:01:13,609 analog signals are functions of a continuous variable, like time and I show 16 00:01:13,609 --> 00:01:19,997 an a, a typical analog signal here wiggles around and has a continuous range 17 00:01:19,997 --> 00:01:24,848 of values for the amplitude and its functions of continuous time. 18 00:01:24,848 --> 00:01:29,762 Digital signals are discreet value functions of the integers. 19 00:01:29,762 --> 00:01:34,567 So, I show as a bubble plot. values of a signal here, they're 20 00:01:34,567 --> 00:01:37,602 isolated, they only occur at the integers. 21 00:01:37,602 --> 00:01:43,510 And you'll notice these various fixed set of amplitudes and those are the only 22 00:01:43,510 --> 00:01:48,620 amplitudes that are allowed because it's a discrete-valued function. 23 00:01:48,620 --> 00:01:54,036 So, I want turn now to this is that signal gone through an A to D converter 24 00:01:54,036 --> 00:01:58,257 and you may wonder, well, that doesn't look anything like it. 25 00:01:58,257 --> 00:02:02,928 How in the world can you go back from the digital signal to the analog one? I'm 26 00:02:02,928 --> 00:02:07,239 going to show you you can't. but it's a, a very interesting story when 27 00:02:07,239 --> 00:02:09,608 you get into all the details. Alright. 28 00:02:09,608 --> 00:02:14,802 Well, first thing we're going to do is acquire individual values of the signal. 29 00:02:14,802 --> 00:02:19,422 And we can describe that in the following very simple way. 30 00:02:19,422 --> 00:02:23,937 we're going to start with our, our analog signal. 31 00:02:23,937 --> 00:02:27,092 There it is. And here is our old friend, 32 00:02:27,092 --> 00:02:32,457 the periodic pulse train. So, the separation between the pulses is 33 00:02:32,457 --> 00:02:34,632 T sub s. s means sampling, 34 00:02:34,632 --> 00:02:38,362 and T sub s is going to be the sampling interval. 35 00:02:38,362 --> 00:02:44,435 The width of each pulse is very narrow. Delta is going to be very small for us. 36 00:02:44,435 --> 00:02:50,125 Well, if you just multiply those two signals together, the analog signals 37 00:02:50,125 --> 00:02:55,118 times the periodic pulses, you get this waveform as shown in the 38 00:02:55,118 --> 00:02:58,357 bottom here. And, we're going to make delta so small 39 00:02:58,357 --> 00:03:03,852 that all that really results is that we get the value of the signal at the center 40 00:03:03,852 --> 00:03:07,481 of the pulse. And we'll assume that these pulses are 41 00:03:07,481 --> 00:03:12,171 really, really very narrow. Now, the qeustion is going ot be for us, 42 00:03:12,171 --> 00:03:16,973 can we, from these values, can we connect the dots? Can we connect 43 00:03:16,973 --> 00:03:23,071 the dots filling in what is zero so that looks like the original signal? 44 00:03:23,071 --> 00:03:28,425 And the asnwer is, we're going to be able to do that with no error as long as we 45 00:03:28,425 --> 00:03:32,233 play our cards right. Let's see how that works. 46 00:03:32,233 --> 00:03:38,381 Well, how do you figure that out? you got to look in the frequency domain. 47 00:03:38,381 --> 00:03:44,484 that's why we went. One of the reasons we went through all this effort to learn 48 00:03:44,484 --> 00:03:49,924 about signals in both time and frequency. So, what is its Fourier transform? 49 00:03:49,924 --> 00:03:55,997 So, what I'm going to do is I'm going to express the periodic pulse sequence in 50 00:03:55,997 --> 00:04:02,268 its Fourier series. And we know that that formula corresponds 51 00:04:02,268 --> 00:04:07,144 to the coeffcient values. So, let's do that multiplication by 52 00:04:07,144 --> 00:04:13,352 substituting in that the Fourier series. Rearrange things a little bit, so we're 53 00:04:13,352 --> 00:04:18,071 going to put all the functions that depend on time together. 54 00:04:18,071 --> 00:04:23,391 The questions going to be, what is the Fourier transform of that? Once I know 55 00:04:23,391 --> 00:04:28,629 that, because the Fourier is linear, I know it's just going to be a weighted 56 00:04:28,629 --> 00:04:32,248 linear combination of those individual spectra. 57 00:04:32,248 --> 00:04:38,327 Well, this is an old Fourier property. You multiply by a complex exponential and 58 00:04:38,327 --> 00:04:43,319 the time domain, and that corresponds to a shift in frequency, 59 00:04:43,319 --> 00:04:47,040 a delay in frequency in the frequency domain. 60 00:04:47,040 --> 00:04:52,592 So we get a readily simple result from our Fourier properties that we're going 61 00:04:52,592 --> 00:04:58,390 to have, each terms has a Fourier transform which corresponds to the 62 00:04:58,390 --> 00:05:04,912 original signal spectrum, capital S, shifted over by k/Ts because that is the 63 00:05:04,912 --> 00:05:10,894 frequency of that complex exponential. And then, we're going to get all added 64 00:05:10,894 --> 00:05:14,425 up. So, it's pretty easy actually to find the 65 00:05:14,425 --> 00:05:18,392 Fourier transform of our signal, our sample signal. 66 00:05:18,392 --> 00:05:23,970 It's just a rated linear combination of shifted spectra. 67 00:05:23,970 --> 00:05:28,957 Well, let's look at that in more detail and plot it. 68 00:05:28,957 --> 00:05:36,475 So, I'm going to use for my example a a rooftop spectrum, which I like to use. 69 00:05:36,475 --> 00:05:43,390 This is known as bandlimited. It's a very important consideration for 70 00:05:43,390 --> 00:05:48,377 sampling. And what that means it, it's spectrum is 71 00:05:48,377 --> 00:05:53,557 zero beyond some frequency. Here, that frequency is W. 72 00:05:53,557 --> 00:05:59,947 It also turns out that W is its bandwidth, that's the amount of the 73 00:05:59,947 --> 00:06:04,528 positive frequency axis where the spectrum is nonzero. 74 00:06:04,528 --> 00:06:08,441 But, what's important for us is what the cut 75 00:06:08,441 --> 00:06:12,998 off limit is for the bandlimited part of the signal. 76 00:06:12,998 --> 00:06:17,282 So, that's what the individual spectra look like. 77 00:06:17,282 --> 00:06:22,064 Now, when I delay and add them up with constants, 78 00:06:22,064 --> 00:06:27,817 this might be what I get. So, the, you can see I have taken the 79 00:06:27,817 --> 00:06:34,877 original when k=0, here's the original spectrum, multiply it by C0. 80 00:06:34,877 --> 00:06:39,309 And then, I shift it over by 1/Ts, multiply it by 81 00:06:39,309 --> 00:06:46,371 C1 I get that one, shift it over 2/Ts. I handle the negative indices the same 82 00:06:46,371 --> 00:06:50,352 way. So, this goes on forever and ever, and 83 00:06:50,352 --> 00:06:56,420 ever, as you might imagine. Now, the question's going to be, can I 84 00:06:56,420 --> 00:07:03,472 get back the original spectrum? Can I go from this and somehow get back? 85 00:07:03,472 --> 00:07:07,733 That would not bear. And the problems going to be these 86 00:07:07,733 --> 00:07:12,058 overlap regions. This is called aliasing, it's a technical 87 00:07:12,058 --> 00:07:15,392 term. And what happens in here is that we get 88 00:07:15,392 --> 00:07:21,072 these two pieces are added together, they overlap with each other and they're going 89 00:07:21,072 --> 00:07:25,191 to add up, that's what this formula says. And once 90 00:07:25,191 --> 00:07:30,247 they're added, I can't tell you what the individual components are. 91 00:07:30,247 --> 00:07:35,295 If two numbers add up to 3.2, I can't tell you which two unique numbers were 92 00:07:35,295 --> 00:07:38,591 added together to get 3.2. It's impossible. 93 00:07:38,591 --> 00:07:43,778 So, once you get into this area of overlap, I can't tell you what the 94 00:07:43,778 --> 00:07:47,949 original signal spectrum was in that region. 95 00:07:47,949 --> 00:07:52,727 And here, I can, but not in there. I'm in big trouble. 96 00:07:52,727 --> 00:08:00,097 So, what is the criterion by which you don't overlap? Separation between these 97 00:08:00,097 --> 00:08:04,409 is 1/Ts. And that separation has to be greater 98 00:08:04,409 --> 00:08:10,998 than the amount that comes from the part of the origin plus the amount that comes 99 00:08:10,998 --> 00:08:15,856 over from that direction. Well, each of those amounts is W. 100 00:08:15,856 --> 00:08:21,458 So, that has to be greater than 2W, and I can write that the other way by 101 00:08:21,458 --> 00:08:26,705 turning this upside down. The T sub s has to be less than 1/2W. 102 00:08:26,705 --> 00:08:32,109 If we meet this criterion, these individual rooftop spectra will not 103 00:08:32,109 --> 00:08:35,904 overlap. And at least we have a change of getting 104 00:08:35,904 --> 00:08:41,433 back to the original signal spectrum. Well, in this case, what I did is 105 00:08:41,433 --> 00:08:49,147 explicitly draw so that the spectra did overlap and that's what I get for a 106 00:08:49,147 --> 00:08:54,947 spectrum here. I get these overlapping areas, aliasing 107 00:08:54,947 --> 00:08:59,597 as a curve because I didn't sample quick enough, 108 00:08:59,597 --> 00:09:05,777 Ts needs to be smaller. Here's what happens when you do Ts to be 109 00:09:05,777 --> 00:09:10,252 smaller. And now, the individual pieces, the 110 00:09:10,252 --> 00:09:16,612 individual parts, do not overlap. I can see them all very clearly and 111 00:09:16,612 --> 00:09:20,432 that's because I've obeyed the rule that I draw up. 112 00:09:20,432 --> 00:09:26,829 Now, can I go from this back to this? How would I do that? And I think the 113 00:09:26,829 --> 00:09:31,642 answer is fairly obvious. What I would do is filter. 114 00:09:31,642 --> 00:09:38,112 I would apply an, what's called Ideal Low-Pass Filter, having a cut-off 115 00:09:38,112 --> 00:09:45,000 frequency of W that would cut-out all these higher shifted versions of the 116 00:09:45,000 --> 00:09:48,579 spectrum. And sure enough, I get back my original 117 00:09:48,579 --> 00:09:53,992 spectrum multiplied by C0. C0 is just a gain and I could easily 118 00:09:53,992 --> 00:09:59,921 compensate for that a little bit. What's much more important is to get rid 119 00:09:59,921 --> 00:10:03,872 of these frequency overlaps. We do not want aliasing. 120 00:10:03,872 --> 00:10:10,562 So, now the criterion for the sampling theorem, which I'm going to point out 121 00:10:10,562 --> 00:10:15,641 here, here's the criterion. So, we have to have two things. 122 00:10:15,641 --> 00:10:21,175 One is, this signal has to be bandlimited, and we're going to assume 123 00:10:21,175 --> 00:10:26,603 it's W Hertz. And the sampling, the pulse sequence, has to have a period, 124 00:10:26,603 --> 00:10:33,089 sampling interval, that's less than 1/2W. And what we've shown, just by example, is 125 00:10:33,089 --> 00:10:38,680 that if you obey those two rules, then you get a picture that looks like this. 126 00:10:38,680 --> 00:10:44,525 By simply applying a low-pass filter, I can get back the original signal. 127 00:10:44,525 --> 00:10:50,254 So, if I take my signal values, it's all I have is just the values. 128 00:10:50,254 --> 00:10:57,439 Every so often, every Ts, if I multiply that times my original pulse sequence. 129 00:10:57,439 --> 00:11:03,785 So, I take every pulse amplitude and make it s of nTs accordingly. 130 00:11:03,785 --> 00:11:08,468 And then, pass that through a low-pass filter, 131 00:11:08,468 --> 00:11:15,455 low-pass filter is this filter, I get back the original signal with no 132 00:11:15,455 --> 00:11:17,894 error. That is really very nice. 133 00:11:17,894 --> 00:11:22,952 And when it got, by the way, remember this is a frequency domain way of looking 134 00:11:22,952 --> 00:11:25,819 at it. It wasn't in the frequency domain, we 135 00:11:25,819 --> 00:11:28,686 wouldn't be able to say one way or the other. 136 00:11:28,686 --> 00:11:33,719 Now, this criterion is usually not specified in terms of the sampling 137 00:11:33,719 --> 00:11:37,040 interval. Rather, it's usually specified in terms 138 00:11:37,040 --> 00:11:43,017 of what we call the sampling or rate. So, the rate of course, is just one over 139 00:11:43,017 --> 00:11:47,635 the interval. And so, our criterion for obeying the 140 00:11:47,635 --> 00:11:54,121 sampling theorem is that the sampling rate has to be twice the highest 141 00:11:54,121 --> 00:11:59,097 frequency in the signal s. So, this low-pass filter here, by the 142 00:11:59,097 --> 00:12:04,179 way, is here to make sure that the signal is bandlimited. 143 00:12:04,179 --> 00:12:10,453 there are some A to D cards out there for computers that are pretty sloppy. 144 00:12:10,453 --> 00:12:14,575 And they don't have this first low-pass filter. 145 00:12:14,575 --> 00:12:21,415 And so, it is possible that you can send in a signal and that would be aliased 146 00:12:21,415 --> 00:12:26,738 once you've sampled it. But high quality A to D converters, 147 00:12:26,738 --> 00:12:33,514 analog to digital converters, have this front end filter which is called an 148 00:12:33,514 --> 00:12:39,192 anti-aliasing filter, for obvious reasons. It prevents aliasing. 149 00:12:39,192 --> 00:12:45,379 Then, the sampling rate inside has to be greater than twice the bandwidth of the 150 00:12:45,379 --> 00:12:50,079 front end filter. And if you do that, I can, from these 151 00:12:50,079 --> 00:12:56,155 sample values of the signal, get back the original reform in continuous time, I 152 00:12:56,155 --> 00:13:00,264 emphasize that. Just from a few values, I can get back 153 00:13:00,264 --> 00:13:06,151 the original signal very, very nice. Well, that's the first phase. 154 00:13:06,151 --> 00:13:12,895 we have a discrete time signal. Discrete time means we are in discrete 155 00:13:12,895 --> 00:13:18,237 time we only have the signal values of every T sub s seconds. 156 00:13:18,237 --> 00:13:25,087 It's not digital yet because the values coming out of here are continuous, in 157 00:13:25,087 --> 00:13:30,322 general. You put in a sign wave you get kinds of different values. 158 00:13:30,322 --> 00:13:36,737 It's not a discrete set of amplitudes, and so you have to do that phase next. 159 00:13:36,737 --> 00:13:41,342 And that's the nice part of a real world A to D converter. 160 00:13:41,342 --> 00:13:44,169 So, here is the sampling part to be created in order. 161 00:13:45,701 --> 00:13:50,625 And, of course, we can get back the original signal with that error if we 162 00:13:50,625 --> 00:13:54,432 just stop there. But now, we have to convert it to a set 163 00:13:54,432 --> 00:13:58,894 of discreet values, and that's called Amplitude Quantization. 164 00:13:58,894 --> 00:14:02,632 And I denote the amplitude quantization function iq. 165 00:14:02,632 --> 00:14:10,174 And what it looks like is what's called a staircase function. 166 00:14:10,174 --> 00:14:19,219 So, this is a function so any value here in that range gets called a 5, 167 00:14:19,219 --> 00:14:24,121 as you can see. And that's how we convert from a 168 00:14:24,121 --> 00:14:28,048 continuous set of values into a set of discrete ones. 169 00:14:28,048 --> 00:14:34,142 Here, I'm going from something that goes from -1 to 1 and from something that has 170 00:14:34,142 --> 00:14:38,468 integer value 0 to 7. Well, I think you can see this may be a 171 00:14:38,468 --> 00:14:43,012 function going this way. But coming back, if I tell you it's 5, I 172 00:14:43,012 --> 00:14:47,512 can't tell you precisely what the original signal value was. 173 00:14:47,512 --> 00:14:52,462 And that's the error that's inherent in amplitude quantization. 174 00:14:52,462 --> 00:14:58,252 Amplitude quantization introduces error. So, here's the, their, the signal at 175 00:14:58,252 --> 00:15:04,508 various stages in our A to D converter. Here's our regional signal, here it is 176 00:15:04,508 --> 00:15:09,448 after it's been sampled. And if the signal is being limited than I 177 00:15:09,448 --> 00:15:15,218 can from my little discrete values in time, get back the original signal which 178 00:15:15,218 --> 00:15:18,846 I showed is this ghostly dotted line underneath. 179 00:15:18,846 --> 00:15:22,512 I can connect the dots in exactly the right way. 180 00:15:22,512 --> 00:15:29,544 But then, once I go through the amplitude quantization part, that's now I only have 181 00:15:29,544 --> 00:15:36,200 eight possible values for the amplitude corresponding with the integer 0 to 7, 182 00:15:36,200 --> 00:15:41,886 and you can see the layering. And since these values do not correspond 183 00:15:41,886 --> 00:15:46,092 exactly to the values over here, there's an error. 184 00:15:46,092 --> 00:15:50,856 I cannot get back the original signal. So, we'd better appre, get some 185 00:15:50,856 --> 00:15:54,109 understanding of how big these errors can be. 186 00:15:54,109 --> 00:15:58,719 That's going to be important. So, and can we control those errors. 187 00:15:58,719 --> 00:16:04,865 So here's my quantization function. And let's blow up one of those intervals, 188 00:16:04,865 --> 00:16:10,955 let's look at it in some detail. So, every value in this interval is 189 00:16:10,955 --> 00:16:16,626 called a 4, right? So here is my original signal 190 00:16:16,626 --> 00:16:22,846 value. And, since it's in this interval, it's called 4. 191 00:16:22,846 --> 00:16:30,695 Well, once I get a value of 4, how do I translate that back into some amplitude 192 00:16:30,695 --> 00:16:33,767 value? There's going to be an error, which I 193 00:16:33,767 --> 00:16:37,603 call epsilon. But the question is, what do I use to, 194 00:16:37,603 --> 00:16:43,274 for the value to call it? And I think it makes a lot of sense that the value on a 195 00:16:43,274 --> 00:16:48,512 side tube the amplitude is the value in the center of the interval. 196 00:16:48,512 --> 00:16:51,940 If you picked over here, there's a huge error involved. 197 00:16:51,940 --> 00:16:56,785 If you picked over here, well, the error may be smaller for this signal value but 198 00:16:56,785 --> 00:16:59,669 the one over here is going to incur a large one. 199 00:16:59,669 --> 00:17:03,512 It seems to me a good compromise. It's just to pick the middle. 200 00:17:03,512 --> 00:17:06,879 And you can show that, that is the right one to pick. 201 00:17:06,879 --> 00:17:11,111 Well, the question is, how big is that error sort of on average? 202 00:17:11,111 --> 00:17:15,723 And what I'm going to calculate is the RMS value of the error. 203 00:17:15,723 --> 00:17:21,624 So, same calculation we've done before, we take the squared error. we're going to 204 00:17:21,624 --> 00:17:24,772 integrate it over the width of the interval. 205 00:17:24,772 --> 00:17:30,600 Since we're assuming we're in the center, we go from 2 plus delta over 2 down to -2 206 00:17:30,600 --> 00:17:36,305 delta over 2 relevant to that center, and divide by the total width. Take the 207 00:17:36,305 --> 00:17:41,947 square root, do the integral, and divide by delta, you'll get delta squared over 208 00:17:41,947 --> 00:17:44,058 12. It's a classic answer. 209 00:17:44,058 --> 00:17:47,602 So the RMS is the square root of delta square over 12. 210 00:17:47,602 --> 00:17:54,703 Now, little important fact is what's delta. Now, I have assumed that the 211 00:17:54,703 --> 00:18:02,488 signal is amplitude limited, which is not a bad assumption for most real world 212 00:18:02,488 --> 00:18:09,858 signals, goes between -1 and 1. In general, the signal goes between plus 213 00:18:09,858 --> 00:18:15,296 and minus its maximum magnitude, I think is pretty obvious. 214 00:18:15,296 --> 00:18:21,445 So, the total range across here is 2 times the maximum, value. 215 00:18:21,445 --> 00:18:26,172 The number of quantization intervals is 2^B. 216 00:18:26,172 --> 00:18:34,030 So, I show here 8 quantization intervals, that's what I've used in this example. 217 00:18:34,030 --> 00:18:41,185 What is B that corresponds to 8 quantization intervals? Well, I'm sure 218 00:18:41,185 --> 00:18:45,892 that you know, since you know your powers of 2, 219 00:18:45,892 --> 00:18:49,903 that 8 is 2^3. So, this is what's known as a 3-bit 220 00:18:49,903 --> 00:18:53,523 converter. It turns out you can't buy a 3-bit 221 00:18:53,523 --> 00:19:00,425 converter that's way too few, and use it here, using it here as an example so we 222 00:19:00,425 --> 00:19:03,341 can see what's going on. Alright. 223 00:19:03,341 --> 00:19:10,011 What I need to do, though, is have some measure of quality of the amplitude 224 00:19:10,011 --> 00:19:14,156 quantized signal. And the typical thing that we use is 225 00:19:14,156 --> 00:19:19,383 called signal-to-noise ratio. So, it's defined to be the ratio of the 226 00:19:19,383 --> 00:19:25,448 signal power to the noise power. And noise in quote in here because it's 227 00:19:25,448 --> 00:19:32,249 the amplitude quantization here. So, the bigger the SNR, the better, the 228 00:19:32,249 --> 00:19:37,537 happier I am. That means, relative to the signal, the 229 00:19:37,537 --> 00:19:42,900 error is small. So, we have a signal plus error, and this 230 00:19:42,900 --> 00:19:48,897 is the original signal value. And so, the bigger this is relative to 231 00:19:48,897 --> 00:19:54,087 that, relative to the, relative to the error, the bigger the SNR. So, let's go 232 00:19:54,087 --> 00:19:58,886 through the calculation. So, what's the power in the signal? Well, 233 00:19:58,886 --> 00:20:04,472 I'm going to assume that for this calculation, that my signal is a sinusoid 234 00:20:04,472 --> 00:20:12,112 whose amplitude is A. And we know from what we've already done that the power in 235 00:20:12,112 --> 00:20:16,333 a sinusoid is the amplitude squared over 2. 236 00:20:16,333 --> 00:20:24,084 Epsilon, as is determined by delta, the power in the error is delta squared over 237 00:20:24,084 --> 00:20:31,812 12 And now, delta is going to be the twice the amplitude of our sine wave, 238 00:20:31,812 --> 00:20:37,912 2A/2B. And so, you simply do that calculations 239 00:20:37,912 --> 00:20:42,951 to get in. And notice that the amplitudes cancel so 240 00:20:42,951 --> 00:20:48,718 our result is going to apply no matter how big the signal was, or how small, as 241 00:20:48,718 --> 00:20:54,603 long as the A to D converter takes into account that range of variation the SNR 242 00:20:54,603 --> 00:20:59,430 is fixed, it doesn't matter. And what you get is a somewhat weird 243 00:20:59,430 --> 00:21:00,526 answer. It's 3/2*2^2B. 244 00:21:02,091 --> 00:21:05,652 Now, the important part here is the SNR 245 00:21:05,652 --> 00:21:11,927 increases exponentially with B. So, the more bits you use, the finer the 246 00:21:11,927 --> 00:21:18,802 quantization interval, the smaller it is, and the SNR goes up exponentially. 247 00:21:18,802 --> 00:21:23,932 So, the way to reduce quantization error is to have more bits. 248 00:21:23,932 --> 00:21:28,990 it turns out that more bits could be a very expensive, A to D converter to buy. 249 00:21:28,990 --> 00:21:33,854 But no matter how many bits you can use in your A to D converter, there's still 250 00:21:33,854 --> 00:21:37,851 going to be some error. We cannot get back the original signal 251 00:21:37,851 --> 00:21:42,136 exactly, but the error can be reduced by controlling the number of bits. 252 00:21:42,136 --> 00:21:47,761 Now, it turns out that SNR is not usually stated this way. 253 00:21:47,761 --> 00:21:51,891 It's stated in a quantity called decibels. 254 00:21:51,891 --> 00:21:59,686 And here is a complete video on decibels that you may want to look at if you don't 255 00:21:59,686 --> 00:22:05,705 know about the decibel scale. It's a logarithmic scale. 256 00:22:05,705 --> 00:22:14,002 And since this, since this is a power ratio, x in dB, is always written 257 00:22:14,002 --> 00:22:22,141 lowercase d uppercase B, is equal to 10 log 10 of x divided by some reference 258 00:22:22,141 --> 00:22:26,935 number. That's how you convert from, or number x 259 00:22:26,935 --> 00:22:31,606 that you may calculate and, and express it in dB. 260 00:22:31,606 --> 00:22:38,784 Well, the reference here is 1. And after I take the log and take care of it, this 261 00:22:38,784 --> 00:22:43,324 is what I get for the SNR expressed in decibels. 262 00:22:43,324 --> 00:22:49,667 This term, And I think it's pretty clear it comes from the 3/2. 263 00:22:49,667 --> 00:22:56,683 And I'm going to let you figure out that 6b amounts to 2^2B expressed in decibels 264 00:22:56,683 --> 00:23:00,338 if you want to figure that out for yourself. 265 00:23:00,338 --> 00:23:05,702 So, what's very common is, is to have a 8-bit converter. 266 00:23:05,702 --> 00:23:11,075 Most computers have at least 8-bit converters. 267 00:23:11,075 --> 00:23:18,471 And that means the signal to noise ratio is 48 plus a little bit. 268 00:23:18,471 --> 00:23:25,371 Well, 48 is almost 50. And because the definition of decibels, 269 00:23:25,371 --> 00:23:34,006 that's almost 5 orders of magnitude. So, with a 8-bit converter, we're almost 270 00:23:34,006 --> 00:23:41,843 guaranteed that the signal in general has a power that's 10^5 times the power of 271 00:23:41,843 --> 00:23:46,892 the quantization error. You may say, wow, that really is pretty 272 00:23:46,892 --> 00:23:50,892 good. I don't think I need to get much better than that. 273 00:23:50,892 --> 00:23:56,142 It turns out that there are people out there who think, they claim to be able to 274 00:23:56,142 --> 00:24:01,067 hear a noise that's that small. That's with the SNR is 50db, they claim 275 00:24:01,067 --> 00:24:04,667 they can hear that. And I think that's pretty close to the 276 00:24:04,667 --> 00:24:08,017 threshold of hearing. So, 8-bits may suffice for some 277 00:24:08,017 --> 00:24:13,974 applications for high quality audio more bits are used. 278 00:24:13,974 --> 00:24:24,100 In fact, I want you to go and look up what the CD sampling rate is and how many 279 00:24:24,100 --> 00:24:29,592 bits are used in CDs, in the original CDs. 280 00:24:29,592 --> 00:24:33,935 I think you'll be pretty surprised at what the answer is. 281 00:24:33,935 --> 00:24:39,633 And furthermore, once you know what the sampling rate is, I want you to tell me 282 00:24:39,633 --> 00:24:43,755 what the upper limit for the signal is assumed to be. 283 00:24:43,755 --> 00:24:50,109 What's the bandlimited quantity w for the signal for a given sampling rate used for 284 00:24:50,109 --> 00:24:51,142 CDs. Okay. 285 00:24:51,142 --> 00:24:56,752 So, this is the story of Analog-to-Digital conversion. 286 00:24:56,752 --> 00:25:03,145 the sampling part, which we see here occurs with no error. 287 00:25:03,145 --> 00:25:08,848 No error at all. It's all in the amplitude quantization 288 00:25:08,848 --> 00:25:11,422 part. It reduces error. 289 00:25:11,422 --> 00:25:16,334 It's inherent, we cannot avoid quantization here. 290 00:25:16,334 --> 00:25:24,103 But, we can figure out how big it is, and we can control it by using more bits. 291 00:25:24,103 --> 00:25:27,246 The more bits we use, the smaller the error.