 So this topic on data transmission we have just one one section left channel capacity and what we want to arrive at at the end of the lecture today is two different equations that show us a relationship between bandwidth, bandwidth of our link and data rate, also called capacity. Channel, our communications channel or communications link, capacity is how fast we can send bits across that channel. So think of the capacity in terms of bits per second. So we'll see a relationship between bandwidth and data rate. But to do this, to understand this, we have to introduce one or two different concepts along the way so it would take the whole whole lecture. And the first concept is decibels. Hands up if you know about decibels, DB. Everyone's heard of DB decibels? Okay, simple. What's a decibel? Well we would see in communication systems that we use DB to measure systems or measure in particular gain and loss of systems. So we need to explain a bit about decibels first. And I'll go through some first some simple examples. For any system whether it's communications, almost any system where we have some input and output, we can look at the gain of that system. So a financial system, you go and invest a thousand baht in some company. And then a week later you get return of 2,000 baht. What's your gain in that case? You start with a thousand baht, you invest it and a week later they give you some money, 2,000 baht. Your money plus another 1,000. How do you say, how much did you gain in that case? How much money did you gain? 1,000 baht? Okay, that's the absolute how much money you gained, 1,000 baht. Now think of how much you gained relative to what you started with. Start with 1,000, end up with 2,000. What's your gain relative to the input? Sorry? 100%. Okay, correct. And another way you can look at it? So you're correct, but there's another way that we can describe we could say I doubled my money. I start with 1,000 and come back with 2,000. I've doubled my money, which is really a factor of 2. That is, take the input multiplied by 2 and I get what I received at the end. So we can say that's one way to express the gain as some factor or as some ratio between the output and input. So in this system, I can say my gain is 2, a factor of 2. I start with 1,000 baht, I invest it and a week later I only get 250 baht back. What's my gain? Haven't been successful. What's my gain now? I've lost I know 750 baht, but from a relative perspective, what would I express the gain as? Any guess, attempts? 0.25, one quarter. I start with 1,000, end up with 250, that is, I've got a quarter of what I started with. So think about a multiplier. The end value is 0.25 times by my input value, my initial value. So that gain is the multiplier. In the first example, I start with 1,000, multiplier by 2, the gain, I end up with 2,000 baht. In the second example, I started with 1,000, I multiply by 0.25, one quarter, and I end up with 250 baht. So that multiplier is the gain of the system. In this case, it's less than one. What's another word for a gain which is less than one? I didn't go up. So what happened? What happened to my money? I lost money. I start with 1,000, I end up with 250, I've lost money. So we can also say that's a loss in that system. And a way to quantify that loss would be a factor of four. I start with 1,000, I end up with 250, I'd say that's a loss by a factor of four. I've got four times less than what I started with. So in fact, the loss is an inverse of the gain. My gain in that system is 0.25, one over four. My loss was four, just the inverse. So with any system, we can talk about the gain and the loss of the system. And it's especially used in communication systems. For example, I transmit a signal from my laptop to the access point. That signal has some strengths. And we said yesterday with attenuation, the signal gets weaker. By how much weaker? Or another thing we say, we lose power. We start with some power. The signal gets weaker. We end up with some received power. So we've lost some power. We often want to measure how much we lose. Similar sometimes we have an amplifier. In my audio system, I talk, so I produce audio at one output. It goes through the microphone to the amplifier which increases the signal output. So what you hear by the speakers is louder than what is coming out of my mouth. So there's a gain in that system. So we want to quantify the gain and loss of communication systems. So think simply, the gain is a multiplier. We can express that with some picture and simple equation. Let's try. What do we start with? We have a system. I'll just represent as a box. And we have some input. Something comes in and something comes out. And with communication systems we often care about power. I transmit my signal with some power level. My audio system has some power output. Power usually measured in watts. So I'll say the input to my system is some power level P in. And the output P out, P for power. So here's my system. I take some input power into my system and it does something and I get some output power. Well, the gain of that system is the ratio of the output divided by the input. So we can say the gain, let's say G, is P out divided by P in. Same as our money example. I started with 1,000 baht. I end up with 2,000 baht. The gain is 2. 2,000 divided by 1. Or in watts, for example, I have a communication system or maybe an audio system. My input is 1 watt. It feeds into the amplifier. The amplifier has a gain of 2. So therefore the output of that amplifier, P out, will be 2 watts. So an example. This is the input, 1 watt. That's this out. P out is 2 watts. We'd say the gain of that audio system is 2. There's no units on the gain. It's unitless. It's a factor, 2 times larger. The output is 2 times larger than the input. The loss is the inverse of the gain. So we can write a general equation. Another way, we can also talk about loss L. Simply is P in divided by P out. Sorry. P in divided by P out. In this case, we could say the gain is 2. The loss is 1 half. It means the same. Just the inverse of each other. I transmit using my laptop to the wireless access point. I transmit a signal. That signal, think of some sinusoid, has some magnitude, some signal strength. We can measure that in as a power level. And let's say I measure the output signal from my laptop. It would be 100 milliwatts. It's 100 milliwatts. A typical value of a wireless transmitter. It transmits power at 100 milliwatts. It propagates across the air. It loses strength across distance. It attenuates. And let's say I measure it at the receiver, and the measured value at the receiver is 1 micro watt. What's the loss? That's 100 milliwatts. Not 160. 100 milliwatts in the transmit power. We lose signal strength across the distance. That's something we cannot avoid. It attenuates. And the receiver has 1 micro. This is mu here, or u. 1 micro watt. What's the loss factor in this case? So be careful with the prefixes. Million micro watts. But otherwise, loss, think of the input divided by the output. Anyone? How many micro watts in 1 milliwatts? Millie, remember, is 10 to the minus 3. Micro, 10 to the minus 6. So there's 1,000, or 10 to the power of 3, micro watts in 1 milliwatts. 1,000 micro watts in 1 milliwatts. Therefore, in 100 milliwatts, there would be 100,000 micro watts. Or, if you want to do the maths, you just 100 by 10 to the minus 3 divided by 1 by 10 to the minus 6. And the answer, 100,000. No units. The loss factor is 100,000. That is, I transmit my signal at this level. It's reduced by a factor of 100,000 by the time it's received. Any questions about gain or loss? We haven't got the decibels yet, but we will next. Gain, the factor we increase, loss, the factor we reduce by. They're the inverse of each other in these absolute values. So we can use these values, gain and loss. But in practice, especially when we have very large values, very large loss values, or very small values, and when we want to perform operations on those values, it sometimes helps to convert them into a different scale. And that scale is decibels. So a decibel is also a measure of the ratio of two levels, two power levels. The gain is one power level divided by another. The general formula for a decibel for the gain, we can express the gain in dB decibels. And the general formula, 10 times log in base 10 of the gain in the absolute value. This is dB decibels. That is, if we know the gain that we've calculated above the absolute value, like two or a loss of 100,000, to convert it into the decibel form, we take the logarithm in base 10 of that value and multiply by 10 and we get the gain in dB. What we're actually going through is in some of your, one of your handouts toward the start of your lecture notes, the definitions, concepts, acronyms, prefixes, logarithms, decibels and signal strength. So you've also have some of it in your notes. This equation. The gain in dB is 10 times log in base 10 of p out divided by p in, where in my notes I've written p out divided by p in is just g. So note there's a different subscript g, I say is the absolute value. G subscript dB is the gain in decibels. Think of it as just a different scale. The same can be said for loss. The loss in dB is 10 log base 10 of the loss, the absolute value. So dB is not a unit here. It's still when we say 10 dB, 20 dB, it's still talking about a ratio of two different levels. But it's just on a different scale than our normal absolute factor. And we take a logarithm and the properties of logarithms often help with if we have numbers in dB, then we can perform operations easier than if they're in the absolute value. And that's one of the advantages of using decibels. Also, when we have very large numbers, this isn't too large, but 100,000, what's the loss in dB for 100,000? Calculate the loss in decibels. If l is 100,000, the loss in decibels, log base 10 of 100,000, which is, okay, this is stuff you did five years ago, logarithms. What's the log of, let's start simple. What's the log of 10? 1. What's the log of 100? What's the log of 1,000? Log of 10,000. The log of 100,000. 5. We're using base 10 here. 100,000 is 10 to the power of 5. The log of 100,000 is 5. Multiply by 10, we get 50 dB. L equals 100,000 is the same as 50 dB, 50 decibels. Just the same value, but in using a different scale here. What about the gain of 2? How many dB? Approximately. The gain of 2? Well, you may need your calculator. That's later. With the gain of 2, the log of 2 is 0.3 approximately, times by 10, about 3, 3.01 in this case. So a gain of 2 is equivalent to 3 decibels, 3 dB. So a gain of 2, I won't write it down, 3 dB. And that's actually one useful one to remember, because a gain of 2 is quite common. A gain of 2 is 3 dB means if we double something, it's a 3 dB increase. Let's write it down. A gain of 2, we've got 3 dB, about 3 dB. What's a gain of 4? How many dB? Of course you can use your calculator, but maybe you'll find that it's just doubled or another 3 dB. You can check. And a gain of 6, anyone want to guess? Sorry, a gain of 8. Doubling each time is a 3 dB increase. So from 2 to 4 is doubled. It's an extra gain of 3 dB. From 4 to 8, if the gain was 8, it would be 9 dB, 16, 12 dB. Just keep adding 3. That's one of the properties of logarithms. When we multiply in the absolute values, we can add when we're using the decibels, the logarithmic values. And that property of the log of A times B is equal to the log of A plus the log of B. So that's sum that we may see in practice that 3 dB, 6 dB is a factor of 2 times 2 or 4. 9 dB, factor of 8. 12 dB, 16. I don't ask you to remember them, but we'll see them in a moment. 3 dB. What's the loss? Loss in dB. A gain of 2 is a loss of, well, forget about decibels. If I have a gain of 2, I can also say that's a loss of 1 half. It's the inverse. I start back to my money. From 1,000 to 2,000 baht is a gain of 2. Or from 1,000 down to 500 is a loss of 2 or a gain of 1 half. They are the inverse of each other. So a gain of 2 is a loss of 1 half, but in dB, a gain of 3 dB is the loss of, now calculate. So the loss is 0.5. Use our same equation. Let's try. So the log, sorry, log of 0.5 times 10 minus 3 dB. Again, due to the properties of logarithms, we will see that a gain of 3 dB is the same as a loss of minus 3 dB, approximately. A gain of 6 dB is the same as a loss of minus 6 dB. When we're using the absolute values, gain and loss are inverses of each other. When we're using decibels, it's the negative of each other. So 6 dB or minus 6 dB. And again, that's much easier when you're dealing with dB. You can quickly convert from gain to loss. Just change the sign of that number. If I have a gain of 24 dB, what's the absolute value? A gain of 24 dB. We're going to need this value later. That's what I want to calculate now. Calculate the absolute value. What's the answer? If our gain is 24 dB, that is the same as, well, 24 dB. We have the value in dB. 24 equals 10 times log of the absolute value. So just solve for this value. 24 equals 10 log something, which means if we divide by 10, 2.4 equals 10 log something. 2.4 equals 10 log something. Therefore, something equals what? 10 to the power of 2.4. And you need to calculate it. I've done it before. It's about 251. Just one example of going the opposite direction. So there's a lesson online for those who can't remember logarithms and exponentials. We're not going to teach them in this course because you learned them many years ago. But go and refresh your memory on some, especially some of the properties of logarithms because they come useful when we do calculations and how to quickly solve them. With that said, you can use your calculator in the exam, but sometimes you need to do something quick in your head. A gain of 251 is also a gain of 24 dB. A difference of 3 dB is a factor of 2. If I go from 3 dB to 6 dB, it's a 2 times increase. If I go from 5 dB to 8 dB, it's a 2 times increase. So a difference of 3 dB is a factor of 2. That's a useful one to remember because you will often see it. We'll see an example of or two examples of decibels. Any questions before we return back to our course, back to our signals? Of course, dB are used not just in communications, well, in many systems. Our audio system, you talk about the characteristic of an amplifier, maybe measured in decibels. Actually, I want one more example before we go to the lecture. Now let's go back to signals. Just a quick example. This is part of our lecture recorded yesterday, some audio, a wave file which I've opened in an audio editor called Audacity and it shows the audio signal as a function of time. So we can see the magnitude varying over time. Over about two minutes of audio. Two and a half minutes. Nothing exciting there. We can zoom in. So it's just a measure of this. So it's an example of a signal, in this case an audio signal. We can zoom in and see the details of that. So that's over a period of 10 milliseconds. We just see the oscillations of the magnitude of that signal. It doesn't look like a perfect sine wave, of course. Our real signals are much more complex than just adding two sine waves together as we see here. It looks like some random variations, in fact. But in theory, what we can do is take this signal in the time domain and do analysis that splits it into a combination of many individual sine waves, sinusoids. And if we then look at each of those sine waves and look at their frequency, we can inspect that signal in the frequency domain. So we can look at the spectrum, the bandwidth of the signal and plot the signal in the frequency domain. This software does it for us. If I zoom out, select all of this. I can do some analysis and plot the spectrum, which is, in fact, produce a plot of this signal in the frequency domain. Remember, we saw plots like very simple ones with some impulses at particular frequencies. But more complex signals have a wide range of frequencies, not just two. This one contains many frequencies. So when I plot the spectrum, it's going to produce a plot like this, but we'll see that there are many, many impulses. And there they are. In fact, there's so many that it combines them, which is the common way to view it. That is, this is the frequency on the axis, on this axis. And this is the peak amplitude. So approximately at the frequency of around 500 hertz, so 0 to 1000 hertz, around 500 hertz, this peak amplitude is the highest. That is, we say that the signal is strongest in these frequencies. We see it's the highest here. In this range of frequencies from 1000 up to 2000, it's much weaker. And there's, in that audio, there's also some frequencies in the up to 15,000, 20,000 hertz. But their magnitude is much smaller. How much smaller? And this is where DB come in. It's commonly used in such a plot. Be careful. This is in decibels. And we see the difference between here and here is 6 dB. A difference of 3 dB is a factor of 2. A difference of 6 dB is a factor of 4. What that tells us is the magnitude of the signal here versus here, this one is about 4 times smaller. So if we drew it, say, one component at the top, and then at this point, it's 4 times smaller or one quarter of the size. Another 6 dB down is another 4 times smaller. That is, the signals here are 16 times smaller than these ones, the magnitude. So even though these look about the same or close in height to here, because it's a scale in decibels, these are much weaker than here. And these are hundreds of times weaker than the signals up to 1,000 hertz. So the audio from yesterday, the main components are from zero up to 1,000 hertz. There are some other weaker components as we increase the spectrum. These are very, very weak, in fact. So there's one example where we see decibels and a much more complex signal in that it's not just two or three sine components, it's a combination of many components, each at different frequencies. Let's try and finish this topic on capacity. So we just introduced decibels, given a quick example of a signal, and now let's look at, given a communications channel with some characteristics, I want to know how fast I can send bits across it. So I have a link, maybe I know it's bandwidth, the range of frequencies I can send through that link, then given the bandwidth and other characteristics of that link, I'd like to know how fast can I send bits? What data rate can I achieve? What's the capacity of that channel? Channel capacity, the maximum data rate at which data can be transmitted across a given communication channel or link. And we'll see some equations and I will use data rate and capacity to mean the same thing. So in the equations we'll see the data rate, which I'd prefer to call it, but it's expressed as C in capacity. And it's measured in bits per second because as computer professionals we care about data rate in terms of bits per second, but the physical characteristics of the link and the signal sent through it, we understand the bandwidth of the signal sent through that channel. What range of frequencies can we send? Some other things that we would need to consider, what if there's noise? What if there's some background noise or other transmitters? Does that impact upon our data rate? And we'll see some different, there's a couple of other factors as well. So yesterday we saw a very simple example with a signal where we had some bandwidth of, I don't know, four hertz and we calculated the data rate of four bits per second. We saw some relationship between data rate and bandwidth. People have done more analysis and come up with theoretical models that relate bandwidth and data rate and they're useful to estimate given a particular bandwidth, how fast can I send data? And two models, which are the main ones, which we'll go through, are called the Nyquist capacity model and the Shannon capacity model, developed mainly by Mr. Nyquist and Mr. Shannon. And they make different assumptions. Let's go through them. And you may have heard of Nyquist in other maybe computer hardware topics, maybe not. We'll see him come up and Shannon. Shannon developed this quite famous model and he did other things like digital circuits and cryptography. His name comes up as doing some important things in many fields of communications and networks. First, Nyquist capacity. Nyquist come up with a model that relates bandwidth to data rate or bandwidth to capacity, assuming there's no noise. We said yesterday there's always noise. But to keep things simple, if there was no noise, no background noise, no other transmitters, Nyquist come up with an equation given here. The capacity of the channel in bits per second is two times the bandwidth of that channel, bandwidth measured in hertz, times by log in base two of some value m. m is the number of levels in the signal being sent. So we'll need to explain that. We'll explain what m is and then with some examples and then come back to how we can use this equation. But this is the Nyquist capacity equation. If we know the bandwidth and we know this value m, we can calculate the Nyquist capacity of our channel. What is m? m is, as I said, the number of levels in our signal. Up until now, we've used two levels in our signals to represent bits. Let's draw some examples. You've seen some before. We had a very simple example yesterday where I drew or in the past, we said that if we think of a simple sine wave, we could use the low portion to represent one bit and the high portion to represent another bit. So if I had a sequence of bits to send, like 0, 1, 1, 0, 1, then I could draw use to represent 0, low for 1, high. The second one, high. 0 is low and the fifth bit, high. We saw some examples like that yesterday where we said in a very simple scheme, when I have a bit 0 transmitted at a low level, when I have a bit 1 transmitted at a high level. But our signal doesn't have to be a simple sinusoid. It can be a combination. So it can be much more complex. But that's a scheme which says each bit maps to one level. There are two different levels in this scheme. High and low. High and low. Okay. Let's draw it as a square wave. All right. I'll draw a square wave because it's easier for me to draw and a larger sequence of bits. Let's say I have 10 bits. Let's extend. 0, 1, 1, 0, 1, 1, 10 bits. Okay. Just some random bits. Then let's use this scheme, low level for bit 0, high level for bit 1 and draw a signal. But in this case, I'll draw it using a square wave. 0, we start with low. And we maintain that level for some fixed period of time. And then bit 1, we go to high. And a second bit 1, we maintain high and down to 0 or low. Then we've got a bit 1 and a second bit 1 and 2 zeros. And in fact 2 ones to finish with. So that red signal is one way to represent those 10 bits. Where the period for each, let's say, signal element is this. 0, 1, 1, 0, 1, 1, 0, 0, 1, 1. Okay. Again, this signal has two levels. And we can describe them and I'll write them on the board so that we can recall them. The scheme here was bit 0, low. Bit 1, high. Two levels. So m is 2 in this case. Now let's do a different scheme. We don't have to just be limited to low and high. Let's do something where we map two bits to one of four levels. We're looking pairs of bits. And I'll design a scheme that says if I have two bits 0, 0, then I'll produce a signal which is, let's say, very low. 0, 1. So very low, let's say negative 5. And 0, 1, just low. So we have minus 3, 1, 0, high. That is plus 3. And 1, 1, very high. This is a different scheme for mapping bits to signals. There are four levels here. m equals 4. Let's try and draw that signal that we need to transmit to represent those 10 bits. Need some space. Actually I want that to be black. Let's draw a green signal, represent those 10 bits where our bit's gone. So 0, 1, 1, 0, 1, 1, 0, 0, 1, 1. What we do now is we take two bits at a time. So the first two bits, 0, 1. Well we're going to produce a signal which is low. And then the next two bits, 1, 0, will be a signal which is high. Try and draw the signal yourself. Well, I think it's quite easy. I don't want that. You made a mistake. The first portion of the signal here is our low signal, 0, 1. This is high, 1, 0. It's a positive value. The next two bits are 1, 1, correct? So very high. And then very low. And very high again. Low, 0, 1, high, 1, 0. Very high, 1, 1, very low, 0, 0, very high, 1, 1. The same 10 bits. If we receive this signal using this second scheme, we'd receive the same 10 bits. The important difference here, two different schemes for mapping bits to the signal levels. Which one's faster? The green one finishes the transmission of those bits in half the time as the red one. If everything else is the same, because for each, let's say, signal element, in the red one, we transmit one bit of information with the green one in the same time, two bits of information. So if we're doing everything at the same speed, we'd be sending twice as much information per second in this second scheme. We send our 10 bits in this period, whereas with the red one, we send 10 bits in double the period, twice a slide. Which indicates that by increasing the number of levels that we have for our signal, we can increase the speed at which we send our bits if everything else is the same. That is, we send the bits in shorter time. These are just two made up example schemes. In another topic, we'll see some realistic schemes, but the principle's the same. The more levels we have, the higher data rate we can achieve. The Nyquist capacity equation considers that. If M is the number of levels in the signal that you're using, and you know the bandwidth of your communications channel, then the data rate that you can achieve is two times the bandwidth log base two of the number of levels. From the equation, we see two quick things. If B increases, if the bandwidth is increased, then the capacity or data rate increases. More bandwidth, more data rate. Similar, increased M, more levels, higher data rate. Going from M equal to 2 to M equal to 4 will increase our data rate. Now let's apply Shannon capacity equation with a couple of quick examples. First example is here. The telephone system has a modem. So you have your computer connected to a modem. Think of the old dial-up modems, which then connects to the telephone line and you send your data across that telephone network. The telephone system supports a bandwidth of 3,100 hertz. How fast can we send data? In the initial case, assume we use a signal with just two levels. Very simplistic, the simplest we can achieve. If M equals 2, what's the data rate? Quickly calculate using the Nyquist equation. Our bandwidth is 3,100 hertz. That's a realistic bandwidth of a telephone link, your home telephone system. In this case, to get started, let's assume the number of levels M of our signal that we use is 2. Using the Nyquist capacity equation, we can simply calculate the data rate or capacity. 2 times the bandwidth times by log in base 2 of M. Log base 2 of 2 is 1 times by 3,100 times 2 is 6,200. Here's a trick or a rule. The bandwidth is measured in hertz. So 2 times 3,100 hertz, capacity is measured in bits per second. The answer is given in bits per second, 6,200 bits per second. With a normal home telephone line, which supports a bandwidth of 3,100 hertz, if I use a simple signal with just two levels, the fastest I can send data, assuming there's no noise, is 6,200 bits per second. Anyone who remembers the dial-up modems? Anyone have a dial-up modem still? No? Anyone remember using them? Before the ADSL modems, you had a dial-up modem which it dialed into the ISP before you started using the internet, made that funny noise and then connected. Anyone had one? Used one? Everyone? Most people? How fast? Faster than 6,200 bits per second. Can you remember the speeds of the dial-up modems? 56 kilobits per second. That was about the highest speed that we got. The original ones were around 28 kilobits per second, but the latest ones, 56 kilobits per second. Those modems use the telephone network, which use a bandwidth of 3,100 hertz. How can we achieve 56 kilobits per second when we're limited in bandwidth? How do you think that modem worked? What that modem did was took your bits from your computer and sent a signal. The bandwidth of that signal was 3,100 hertz. What else did the modem do, related to what we see here? It increases the levels. It must do because, remember this is a capacity. Nyquist equation tells us if we have 3,100 hertz and if the number of levels is 2, you cannot send faster than 6,200 bits per second. It's a capacity, the upper limit. There's no way in the world that you can send faster. That's the way to interpret this Nyquist capacity. In fact, in practice, you would send slower because there's noise and other factors. It's the upper limit. We just said that our dial-up modems, which I'm telling you use the same bandwidth, we think they can achieve 56,000 bits per second. To do that, our modem must use the signal with more than two levels. How many levels? Find the solution. If we know from experience that the capacity is about 56,000 bits per second, same bandwidth, then how many levels did the signal contain? Try and solve that. If we have 56,000 bits per second as the capacity bandwidth of 3,100, what's m? Basically, you use the same equation, but work backwards. Anyone find the answer? Find m to the closest power of 2. To the closest power of 2 is what you need. You don't have an answer yet. Bandwidth is still 3,100 hertz, so b is still 3,100. Close? Good. Correct approach. What did you get? Looks too big. I think your calculator is using log 10, but this is log in base 2. So by rearranging the equation, we know, and we can write it, we get 56,000. The capacity equals 2 times the bandwidth, 3,100 times log base 2 of m. So we get what? 6,200 here. Take it to the other side. So 56,000 divided by 6,200 is about, some people will discover it is about 9. So 56,000 divided by 2 divided by 3,100. So it's approximately 9 equals log base 2 of m. Therefore, m equals 512. Because 2 to the power of 9 is 512. That is, in those modems, the dial-up modems where you achieve 56 kilobits per second, the modem generated a signal, didn't have two levels or four levels, it had 512 different levels. Each level mapped to nine different bits. So it could transmit a signal to carry that data at 56 kilobits per second. And any questions on the calculations? Some basic maths there. In practice, the number of levels is usually a power of 2. So even though this is not exactly 9, 9.03 or whatever, in practice the implementation, because we're dealing with binary, 0s and 1s, the number of levels is a power of 2. Let's return to our equation. So what can we say about some trade-offs that are identified from the Nyquist capacity? If we have a communications link, we know it's bandwidth, we know the number of levels used in the signal we're transmitting, then we can calculate the data rate for that link, the upper limit data rate. Under the assumption there's no noise. And we see if we increase the bandwidth, we increase the data rate. If we increase the number of levels, we increase the data rate. That's direct from the equation. But some practical things. If we increase the number of levels, then it becomes harder and harder for the receiver when it receives a signal to map that signal back to the correct bits. So that's not captured in the equation. But especially in the case of noise, the more levels you use in the presence of noise, the larger the chance you'll get errors at the receiver. So there in fact is a practical limit to M. And in fact in the the home modems, dial-up modems, the practical limit, we just calculated it, 512. Going larger, to say 1024, it wasn't possible to implement the hardware to deal with that state. So they looked at alternative techniques, ADSL for example. So Nyquist capacity says just increase M, keep going and you get higher data rate. But practice tells us that you can't make that too large because it makes the receiver very hard to implement. And in fact in the presence of noise, you start to get many errors at the receiver. You send bits 011 and you start to receive 010. We get bit errors. So that's something to consider when calculating with Nyquist capacity. Well, in real life there is noise. Another guy, Shannon, come up with a different theoretical model, taking into account noise. So Shannon come up with a formula that says if we know the bandwidth of a communications channel, irrespective of the number of levels, if we know something about the noise in that channel, in particular the noise relative to the received signal strength, then we can calculate the data rate of that channel. So we have a new concept here called the signal to noise ratio, SNR. It's the ratio of the received signal and the received noise. And we tried to do that what yesterday. When I talk, someone receives my signal, if other people start talking and the noise goes up, then what do we get? The signal to noise ratio, the noise goes up, the signal to noise ratio goes down. The more noise, the harder it is to receive and the end result, the lower the data rate. So Shannon equated these three factors together. Bandwidth received signal strength or signal power and the noise, received noise. And we see from the equation, higher bandwidth, higher data rate, higher capacity. Increased signal power, so SNR goes up, increased data rate. That is if we transmit at a higher power, the receiver will receive at a higher power and that gives us a higher data rate. And also increased noise, more noise in the system, SNR goes down, so this goes down, data rate goes down. The more noise, the lower the data rate. So that's the relationship between those three factors. Increased bandwidth or signal power increases the data rate, good. Increase of the noise reduces the data rate, bad. And something that's not captured in this equation but again is in practice. If you do increase the bandwidth, according to this equation, we increase the data rate, but it allows more noise in practice. Larger bandwidth signal or system, the more noise can come in. And the more noise, the lower the data rate. So there's in fact a practical trade-off there. You can't just keep making the bandwidth larger because it starts to make the noise larger when everything else is the same. And you can't just transmit at a higher power all the time because the higher you transmit, you start to get interference from other sources. For example, if I want to communicate to you clearly, if there's other people talking, if I keep talking louder and louder or if I keep increasing the amplifier output, the sound level, according to this, it'll be easier to hear, but I start interfering with other classrooms, for example. The classrooms downstairs will start to receive my signal, causing noise for their system. So there are some practical trade-offs to consider between increasing bandwidth and power level. So this is another formula to tell us, given some characteristics of a communication system, how fast can we send bits? Same with Nyquist. This is a theoretical capacity. In practice, there are limitations that mean we cannot actually achieve this capacity. We can get close, but you will not go above it. It's a capacity. And in practice, you will not actually get the exact same value in realistic conditions, but it gives us a good indicator of how fast we can send. Let's give an example, but before we do that, be easy. If we know the bandwidth, we plug it in here. SNR is the signal power divided by the, or think of the received signal power divided by the received noise power. In practice, we usually need to measure the noise. We may not know in advance. We could guess what it could be. So sometimes the SNR, this ratio of the two, may be given for a particular channel. Let's solve this one in two parts, two steps. So we have a communications channel, has a spectrum of between 3 MHz and 4 MHz. That is, it contains frequencies from 3 up to 4 MHz. We know the characteristics of that channel that when we transmit a signal and we measure the noise, the ratio between signal to noise is 24 dB. Forget about the question here. First answer, what capacity can we achieve in that channel using the Shannon capacity equation? We know the spectrum. We know the signal to noise ratio and db. What capacity can we achieve? Try and calculate that. And the hint, which makes it a little bit harder, this equation SNR is not measured in db. It is the absolute value. So this question gives you SNR measured in decibels. You need to convert that back to the original absolute value and then plug it into this equation. Try over the next five minutes. So you use the Shannon capacity equation but you need to find b and SNR in the right or the right values for them. So hint, one thing not to do, do not put 24 here. It's wrong. 24 dB, you need to convert it to the absolute value for signal to noise ratio. So go back to your knowledge of decibels. You know the db value. You need to know the absolute value. And then you can insert the absolute value here where we have SNR. What's b? Anyone help me? What's the bandwidth of our channel? 1 MHz. The spectrum is said from 3 MHz up to 4 MHz. So the width is 1 MHz. What is SNR is your next step. You know in db, convert it back to the absolute value. And we did it before. In the examples of db, that's when I did the calculation. That's why I did it in the first example because I knew we'd need it. Anyone remember the answer? What do we calculate? Someone's got it 251. SNR is 251. 10 to the power of 2.4. Now you can use the Shannon capacity equation. Now you can just plug the values into the capacity equation which is b times log base 2 of 1 plus SNR. b, 1 by 10 to the power of 6 Hz, 1 million Hz, 1 MHz. So be careful here. Log base 2 of 1 plus 251. That is log of 252. Anyone get an answer? What is it? The final answer? 8. About correct. Log of 252 is about 8. Log base 2 of 256 is exactly 8. So log of 252 is a little bit less than 8, 7.9 something. I don't know. But I'll assume that log base 2 of 252 is close enough to 8. So therefore our capacity is about 8 by 10 to the power of 6 bits per second. Or 8 Mbps. And then return to the original question. How many signal levels are required to achieve this capacity? If we want to get 8 Mbps, we know the bandwidth is 1 MHz. Now use the Nyquist equation to determine M. How many signal levels we need? So in fact this is a combination of the two. To get 8 Mbps with 1 Mbps bandwidth, M would need to be what? So recall now the other equation. Capacity equals 2 times B log base 2 of M. We know C, 8 Mbps. We know B, 1 MHz. Find M. Anyone else have M? Correct. So what's M? Good. Okay, some people are on the right track. So just some simple rearrangements of that Nyquist equation. Capacity is 8 Mbps equals 2 times 1 MHz, 2 times 1 million, log base 2 of M. So 8 million equals 2 million log M. Which means log M must equal 4. Which means M must equal 16. It's log base 2. If we wanted to achieve this capacity of 8 Mbps in theory, we'd need to use a signal with at least 16 levels. We could use more, but less than 16 would, according to Nyquist capacity, would not get us to 8 Mbps. Let's summarize. Return to that in a moment. Nyquist and Shannon capacity are theoretical models for determining the data rate, the capacity of a link, given the bandwidth and other characteristics. Nyquist assumes there's no noise, makes an assumption so it's simple to calculate. In reality, there's always noise. It depends upon the number of levels in our signal that we transmit. Shannon assumes that there's noise, and therefore the data rate, the capacity depends upon how much noise, especially how much noise relative to how much signal do we receive, the real signal. So when someone transmits, I receive the signal. How much noise is there relative to that? The more noise, the lower the signal to noise ratio and the lower the data rate. Both of them are theoretical models that we cannot achieve in practice, but we can get close. That is, we can build systems, communication links, which approach the Shannon capacity. So if we know some bandwidth and signal noise ratio, we can implement the hardware to transmit signals which get close to the Shannon capacity, but because of practical limitations, not exactly reach the capacity. And let's stop there. So what you'll do