 Welcome to this lecture on digital communication using GNU radio. My name is Kumar Appaya and in this lecture we are going to continue our look at demodulation in the context of symbol error rates and bit error rates. If you recall in our previous lectures, we have been looking at symbol error rate rather closely and we have seen how we can compute the symbol error rate for a host of constellation types. In particular, we checked it for BPSK, for PAM4, for QPSK, QAM16 and we remarked about the similarities and differences among these. One aspect that we touched upon was that for complicated constellations, you may need to use something like a union bound to have an approximation. But one thing that was left unanswered was this is about symbol error rates. What this course is about transmission of bits. So what is the difference between symbol error rates and bit error rates and how are bit error rates computed for a given constellation. That is the topic that we will concern ourselves with today. So the first thing that you must observe is that bit error rates are different from symbol error rates. The intuition is that in MRE signaling, it is not always the case that when you have one symbol error, all your bits are wrong. For example, in the case of let us say QPSK, in the case of QPSK, you have four symbols. Each symbol corresponds to two bits. So if you send the symbol that corresponds to the bit pair 00, it could be that the symbol gets flipped to 01, meaning it gets switched to the symbol that corresponds to 01 because of the noise. In this case, the 00 is going to be detected as 01. This corresponds to of course, a symbol error as you have seen in the previous lectures. But out of these two bits, only one of the bits is incorrect. Therefore, this particular symbol error resulted in only one bit error. So in the same way extending this, one symbol error does not mean that all bits are erroneous. Therefore, we need to extend our computation of the symbol error rates to actually account for this and therefore, bit error rates also called bit error ratios are different from symbol error rates. Now, this leads to an interesting question which I have already hinted to. You have M symbols and you want to assign bits to these symbols. How do we assign these bits appropriately? For example, let's say that you have a QPSK, which symbol becomes 00, which symbol should become 11, which one should be 01, which one should be 10, does my arrangement of these actually affect the performance? This is something that we will see. For the moment, we will concern ourselves with those constellations where M is the power of 2 so that we can easily assign the bits. For example, if we have a number like 16, that easily means that each symbol corresponds to 4 bits. So does the actual bit allocation to symbols matter? The answer is that in many constellations it does. So you have to carefully allot the bits to the symbols in order to minimize the bit errors in case a symbol error occurs. So that is, you have to make sure that the mapping between the bits and the symbols is made in such a way that for most symbol error events, the number of bit errors is not really high. That is something that we will see momentarily. We will take the example of QPSK. In the case of QPSK, you have let's say 01, 00, 10 and 11, this particular allotment. Let's actually just do this more carefully. So we have 01, 00, 11 and I think you have 10. If you remember our discussion on symbol error rates, then let's say that you look at 01. When you send 01, the most likely events in terms of nearest neighbors as well you can say are the so say QPSK and this and this are the most likely error events. Why is that the case? That is, it is more likely that the real part goes above D by 2 or the imaginary part goes above D by 2, the probability that both go above D by 2 is smaller. If you don't remember this, you can go back to the previous lecture and confirm the probability of these events was actually Q of D upon 2 sigma times 1 minus Q of D upon 2 sigma. While the probability of this particular thing happening was square. That is the probability of both real part and imaginary part going into the incorrect region. This is smaller. So we can essentially say that 01 becoming 11 is less likely. But that's actually not what we want because in this case 01 going to 10 is a problem because this particular event you have 01 becoming 10 corresponds to 2 bit errors. This is a very bad thing because a very likely event is causing 2 bit errors when you have a single symbol error. Similarly for 00 also, if you go here this corresponds to 2 bit errors. Therefore this is a bad allocation of symbols to bits, bad allocation because this particular allocation of bits or mapping of the pair of bits to the 4 QPSK symbols results in likely symbol error events corresponding to a large amount of bit error. This is something that we want to avoid and this is something that we should try to avoid if at all possible. So in this particular manner one symbol error rather the most likely symbol error results in 2 bit errors and that is something which that we want to strictly avoid. So how do you do this? So in this case we now choose a different approach. We say 0 1 0 0 1 0 1 1 that is let me just 0 1 0 0 let's see. I am going to call this gray coded it's in the name of the scientist okay. Gray coding is where you ensure that all the likely events, likely symbol error events result in the minimum number of bit flips. So let me just check what I chose here so I am consistent 0 1 1 1 0 0 1 0. Now let us look at our likely events our let's look at it for this one. Our likely events are this one or likely events are this one. These correspond to only 1 bit error okay therefore the most likely transition of the symbols which is from this particular location to here and this particular location to here these are the more likely ones these correspond to only 1 bit error as opposed to the less likely one which corresponds to 2 bit errors which is okay I mean the sense you cannot avoid it if that happens it is fine but in terms of how less likely it is if this is D and this is D this is D this is T root 2 therefore this is actually much less probable because this appears in the exponential if you look at the approximation for the Q it appears in the exponential and this is going to be less likely. Therefore by performing gray coding you have ensured in this particular constellation that the less likely error events are going to result in exactly 1 bit error for the symbol error and for the you know sorry the more likely symbol error events you are ensuring that there is only going to be 1 bit error for 1 symbol error for the least likely symbol error event you will have 2 bit errors but that's fine but this is much much better than the previous situation if you really want to calculate the bit error probability for this you can go ahead but I am actually going to calculate the bit error probability for this particular gray coded constellation. Let's start with a clean slate okay so I am going to say this is 0 1 this is okay this is 0 1 0 0 1 0 1 1 and if you don't if you recall this particular constellation point was root ES upon 2 comma root ES upon 2 this choice was made primarily because we wanted the average energy to be ES so we choose all of these at a distance of ES root ES from the origin you will end up getting an average energy of this constellation to be ES which is what we wanted now the distance between these two constellation points is D is I mean between the nearest neighbors is it's 2 times root ES upon 2 root ES this is something which you remember now we want to find the bit error rate so let us focus on let's say only one of them let's focus only on the MSB that is we'll focus on this MSB now there are a couple of approaches which you can use but there is a nice trick which you can play the trick which you can play is to observe that the MSB is 0 whenever the received point is above the y axis sorry the above the x axis MSB is 1 whenever the received point is below the x axis that is whenever you are here the MSB is 0 whenever you are here MSB is 1 irrespective of the real point at which you are in on the x axis above x axis first bit is 0 below x axis first bit is 1 so this is a really neat observation meaning you can make decisions about bits optimally without having to for one of the bits optimally without having to care about the other bit but this is something which I remarked about in the previous lecture very briefly although that this is something which is to be expected why the reason is because what we actually have is we have a BPSK sitting on the x axis and a BPSK sitting on the y axis and you're essentially combining them you're combining these to get this particular constellation therefore if you now start looking at QPSK as a pair of BPSK's it will become really easy for you to understand and appreciate the similarity between these and you can also easily compute the bit error rate or symbol error rate so I'm just going to say this is a so combination of BPSK's fine okay let's actually now just compute the bit error rate for qualms bit error rate for QAM4 or QPSK now before we go ahead there is an important point that I have to mention which is about the bit energy so in this case in the case of QPSK the constellation point has energy ES and this ES corresponds to two bits and therefore what is the energy per bit since ES corresponds to one constellation point and one constellation point has two bits we will define a new quantity called EB which is equal to ES upon bits per symbol which in this particular constellation is ES upon 2 so ES upon 2 is our EB now let us actually find out this particular you know bit error rate for this but even before that let's actually do it for BPSK for BPSK it's very easy you have this you have this and this is 0 and this is minus root ES plus root ES ES corresponds to one bit therefore EB is equal to ES therefore the bit error rate is actually the symbol error rate why one bit is one symbol so we can write this as Q of root of 2 EB upon n naught why because in the case of BPSK one symbol error corresponds to one bit error okay and that's the only event which is possible so the symbol error rate and bit error rate are the same Q of root of 2 ES upon n naught which is the same as Q of root of 2 EB upon n naught but for QPSK it's a little complicated and tricky but there are a couple of ways to do this first if you observe the fact that our only the imaginary value is going to determine your MSB then the only thing you need to concern yourself yourself with is the value of the imaginary axis of the received point therefore you just have to decide on the y-axis projection what the value is and as you recall you had Gaussian noise therefore for for QPSK let's say you had this this is the distance and remember D is the distance and our recipe was always Q of D upon 2 sigma okay Q of D upon 2 sigma in this case however our D is going to be root 2 ES so this is going to be let me just write it in a more neat way okay so now Q of D by 2 sigma which is equal to and remember that our D is actually 2 root ES but 2 root ES is 2 times you know 2 times ES but EB is actually ES upon 2 so our D is actually going to be 2 times so what I am trying to point out is that ES is 2 EB so this is equal to Q of root of 4 EB okay divided by 2 times root of N0 by 2 why did I do this because it is D upon 2 sigma and remember N0 by 2 is the amount of noise per dimension so we get this to be Q of root of and this 4 and 2 cancel 2 EB by N0 okay this is what we get now here there is some element of confusion or you know worry because you I said for BPSK it's Q of root of 2 EB by N0 while for QPSK also it is Q of root of 2 EB by N0 what gives well it turns out that the formula for both is the same but since the constellations are different the amount of power that you spend which is ES in both the cases is different that is in the case of QPSK your ES is actually 2 EB when in the case of BPSK the ES is actually EB and because of that the amount of noise that actually affects you in the case of BPSK is only the real noise in the case of QPSK there is real noise and imaginary noise affecting each part so now this Q of root of 2 EB by N0 is the bit error rate probability for the MSB and I don't think you will be surprised by symmetry for the LSB also it is the same so this way we can actually compute the bit error probability for QPSK as well now let's actually go back to our discussions so for the case of QPSK we have root Q of root of 2 EB by N0 okay this is actually incorrect this is actually ES by N0 okay this is the key take away from this that you can look at it as 2 BPSK and use the same approach and the formula turns out to be the same form but note the difference in the case of QPSK BPSK has ES equal to EB QPSK has ES equal to EB that is the key difference now in the case of PAM4 let's actually just try to brainstorm a little and try to see what happens in the case of PAM4 actually let me just let me make another remark before I go to PAM4 if you remember we had a complicated formula for the similar rate for QPSK right let's actually just get that so 0 0 0 1 1 1 1 0 and remember Q of root of 2 EB by N0 which is equal to Q of root of ES by N0 is the probability of making a bit error now if you want the simple error probability you can actually compute it very easily now the simple error probability is equal to and just go back in our slides you can get the expression yeah it was Q you know 2 Q of ES minus square and all those you can actually get this from the you can actually get this from this particular bit error rate expression a simple error occurs when at least one bit error has occurred at least one bit error has occurred when there's actually the 1 minus no bits have occurred so it's actually you can do it in multiple ways what at least one bit error has occurred so what is one bit error occurring mean one bit error can occur because of this so that leads to this you know Q of root of 2 EB by N0 is a probability that the MSB gets flipped plus Q of root of 2 EB by N0 sorry let me just change it up and I wanted to write this as ES so that you know your consistent okay so this is ES here also we write ES minus of course so this is basically one has occurred another has occurred minus both this is the event with that corresponds to both the bits getting flipped that is double countered so we'll do minus you can use the bit error rate formula to compute the symbol area it as well you just have to look at the probability of making at least one bit error okay the other approach is to just say the probability of getting at least one bit error one minus no bit error has occurred and no bit error you can always just use the Q formula and figure it out so if you want to do that you'll essentially have to do one minus one minus Q the whole square and you'll get the same result now let us just move to Pam 4 I'm going to write 1 2 3 4 and you can write the normalized forms I have no you know I'm not going to do that right now but you have to now assign 4 that means you have to assign a pair of bits to each you can do 0 0 0 1 1 0 1 and 1 0 and 1 1 so this evidently is not a good idea because if you look at these two these are nearest neighbors and a single bit error results in sorry single symbol error results in two bit errors this is a very likely event because these are very close and a single bit error results in single symbol error results in two bit errors so you should not do this so this is not the right way so I'm going to just undo what I did here and I'm going to write 1 1 1 0 now if you look at this these two are close one symbol error results in one bit error these two are close 0 1 and 1 1 1 similar error only one bit is flipped these two are close one symbol error only one bit error that's it so in this particular scenario the bit error rate is minimized because of your the fact that you have done gray coding wherein you have ensured that a flip of one bit flip of a symbol results in only one bit flip in the most likely symbol flip event of course you can still say what if I go from here to here okay it is true you will get two bits what if we go from here to here of course you'll get two bits in incorrect but still it is better than the old one because these two are much further in fact twice as far the probability of those events is much less likely therefore for pan 4 you should use gray coding and like I did 0 0 0 1 1 1 1 0 the most likely event lead to only one bit error the BR can be found much like VPSK except there is a slight issue the issue is you have to do it separately for this one and this one and separately for these pair as well because in this particular case for 0 0 to 0 1 it's very easy you just have to find see for example 0 0 going to 0 1 right you just have to find the probability of this particular symbol landing in this region because that is the region where that's the reason way that's the region where the least significant bit essentially flips in fact over here it doesn't flip so you have to essentially evaluate the error probability by integrating evaluate the error probability by integrating this particular intake this particular Gaussian from this point all the way till this point now similarly for these two you have slightly more complicated scenario because there can be two different error events going to the left and right so over here this 0 over here if you go to the left this one becomes 0 to the right this one remains one but goes further to the right and becomes 0 so you have to be very careful about the exact regions of integration but again if you really want to you can just perform a simulation and try to get the bit error rate as well one thing to remember is that the PAM4 essentially serves as an ingredient for your quam 16 as well now in the case of quam 16 we have to ensure that we do a bit allocation that results in one bit error as far as possible for the least like for the most likely error set symbol error events in this particular gray coding situation we have actually done that what have we done we have said 1 0 1 0 1 0 1 1 so let's look at what we have done here in fact let's search for 0 0 I started here 0 0 0 0 there are two nearest neighbors this one and this one for each of them we want exactly one error was one bit error whenever one symbol error happens so we I chose to flip the third bit from the right here and the first bit over here so I got 0 0 0 0 1 0 0 this is great next let's look at it for this one to the left we've already checked when you go above 0 1 0 0 goes to 0 1 0 1 that corresponds exactly to 1 bit flip 0 1 0 0 to 1 1 0 0 corresponds only the most significant bit flip 1 bit flipped the rest for example these are not significant events because they are much further than the nearest neighbors next if you look at this particular symbol 0 1 0 1 we checked below it's only one bit we check to the left it's only one bit we check to the right 0 1 0 1 1 0 only one bit we check above 0 1 1 1 to 0 1 0 only one bit so if you want to just pause and check this particular configuration ensures that you will have the nearest neighbors all four nearest neighbors for these and all two for these all three for these have only one bit flip this is just an extension of the pamphor or if you want another way I'll give you another way to look at it the MSB the most significant bit is 0 to the left and 1 to the right ok this is a way by which you can get the constellation it's 1 to 0 to the left and 1 to the right next if you look at the least significant bit it actually it 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 ok and if you look at the other bits as well there is a pattern I want to remark that this particular allocation of bits to symbols is not unique and you can come up with your own gray coded version of you know the constellations that is as good as any other as good as this so you'll actually have no problems in coming up with another allocation which will still be gray coded but it will have the same performance and it is equivalent in every other way it's just a question of your choice of mapping now again in this case computing bit errors you can do for example like I told you if you decipher a pattern for the MSB right 0 is on the left 1 is on the right therefore you can just use your BPSK like approach to compute the bit error rate for the MSB but for the others you have to look carefully for example for the let's say third one it's 1 1 here 0 0 here and you have to decipher it more carefully in general it is cumbersome but it is something which you can do again if you don't want to do it or if in a scenario where you don't need to do it you can just perform a simulation in your scenario and get the bit error rate for the SNR that you desire one more remark I wanted to make is that in this case remember 4 EB is yes something that you should keep in mind so let's summarize remember that the ratio of the signal energy and noise energy decides the symbol and bit error rates and we can compute the similar rates you know using accurate approaches or you can approximate them using probability based approaches like the union bound or using the nearest neighbors and approximating it and when it comes to bitter rates the same things apply except that you also have to ensure that you have to first look at the allocation of bits to symbols and only when you allocate bits to symbols then you can compute the bitter rate and when you do the allocation of bits to symbols make sure that you do it in such a way that the number of bit errors for the for the most likely symbol errors is minimized gray coding is a perfect recipe for that basically the most likely symbol errors will result in only one bit error and that is the key to ensuring that you minimize the bit error rate now so far we have looked at the impact of noise on symbols and similar rates and bit error rates but we have still have an idealized communication system where there is no other impairments other than noise in the next lecture series onwards we are going to look at how we can relax the assumptions on ideality of our transmit receiver system they're pairing and so on and see how we can get towards a more realistic communication system model thank you