 Welcome to this lecture on digital communication using GNU radio. My name is Kumar Appaya and I belong to the department of electrical engineering at IIT Bombay. So in this lecture, we are going to continue our look at demodulation and in particular see how we can compute the symbol and bit error rates for various modulation formats. So as an introduction, what we are going to see over this and a couple of lectures are what aspects are aspects connected to signal and noise energy. Then a detailed look at symbol error probabilities and bit error probabilities for various modulation formats and in the context of bit error probabilities, we will take a close look at gray coding and basically how we can allocate bits to symbols so as to have the best kind of performance and minimum bit error rates and finally, we look at several examples for some common constellations such as PAM, QAM and so on. So one important aspect that we have already seen in the previous lectures is that the performance of a communication system does not depend on the signal energy or noise energy in isolation, but it depends on the signal to noise ratio that is the ratio between the signal power and the noise power or signal energy and the noise energy. So it is important for us to be able to compute or characterize the energy of a signal and the energy of the noise. For the energy of the noise, we have actually taken a close look when it comes to our discussion on the signal space and projection of noise onto signals, projection of noise onto the signal space and the so called orthogonal you know basis signals and so on. In the context of signals of course, we have the same kind of concept, but I just want to make it a little more formal for the assumptions for this lecture. If we consider the signal wave form X of t that is a summation S k t minus k t, then what we have is that this basically consists of a sequence of wave forms that are put together and each wave form we are assuming contains some information about a symbol that is your S k of t minus k t actually is B k of g of t minus k t and if you remember your g or g t x was the kind of template pulse which we use with the transmitter. In this case we are just going to assume that it is g, so you have your different S k s conveying different B k s and when we want to compute the energy of a symbol, we essentially have to look at the properties of B k and g of t that is if B k times g of t is the information contained about the symbol within your X of t, the energy of that is what we have to take into account. Typically there may be intermixing of symbols for example, if you have a sync like pulse then of course, the sync pulse spreads across multiple symbols, but we are going to assume that the energy of every symbol is essentially additive without depending on the others that is let us say you take a very simple example in the context of you know match filtering we have seen that you know when you have S of t looking like this right then you have B 0, B 1, B 2, B 3 and so on and when you did the match filtering right you are actually just convolving it with a rectangle and so on, but to actually compute the energy of this symbol what we are going to do is we are just going to take the energy of B 0 over here energy of B 1 over here and whatever interpretation of this is that the energy over here is B 0 square or modulus B 0 square times the energy of g plus modulus B 1 square times the energy of g and so on. So, if we assume that the energy of g is actually like you know unit then the energy of this signal is B 0 square B 1 square plus B 2 square implicitly I am assuming that S 0 and this one are orthogonal that is your S 0 is over here S 0 is actually B 0 times the rectangle which stretches from 0 to t while B S 1 is your rectangle which stretches from 2 t t to 2 t and has amplitude B 1. So, they are implicitly orthogonal. So, if we wanted to consume sorry compute the energy of this particular signal it is B 0 square plus B 1 square plus B 2 square and so on. If you assume that of course that the base pulses this particular rect which I have deliberately chosen to be unit energy if you do not believe me you can integrate this and check. In the context of something which is more complicated such as a sink right. So, you have the sinks which are essentially carrying information and typically the peak of the sink essentially has that information I have also kind of superpose the rectangle in the background. So, that you can see, but the sinks problem is it spreads across it is in fact, if you do not truncate it is for infinite time. But even in this case there is a in a sense of orthogonality that is if you integrate sink of t minus k t and sink of t minus l t both of course scaled upon t you end up getting t times delta k l that is if you take a sink and multiplied by itself and integrate you get some energy if you take a sink and offset it by exactly t and multiply and integrate you get 0. That is sink also has time orthogonality very similar to the rect of course you have to exactly shift the sinks by t. So, what we are trying to get at is that when you want to compute the energy of a signal you just need to know the properties of the constellation that is what B is what B 0's and B 1's can be like are they BPSK or QPSK or QAM 16 or something and the base pulse G. In this case we have just simply said let us assume that the base pulse actually has unit energy and you can also scale your sinks appropriately this is what you need. Therefore going forward we are just going to assume that the energy contained in our modulated signal is just summation B 0 square. Now, one question which you may have is what about in the case where you take it to passband. Now, it is not very difficult for you to just show that even if you take it to passband if you take our scaling factors of root 2 and all correctly the passband signal will also have the same energy. So, there is no confusion and no real issue to handle. Now, signal energy is for the whole signal and you know if you take a normalized unit energy base pulse then the signal energy is just the summation of B k square that is you take every realized constellation point B 0, B 1, B 2 take the mod square and add them up you get the so called energy of the signal. But of course, the energy of the signal will keep going up and up and up as you add more and more symbols, but what we are more interested in is the average energy that is the power of the modulated signal because that is what is going to determine the amount of energy you spend per symbol so to speak. So, the average energy you can assume that it is like take a large block of symbols compute the energy divide by n. So, take n symbols where n is like 10,000 a million or something and average it. So, that is why we write it as limit n tends to infinity 1 upon n summation k equal to 0 to n minus 1 mod B k square. Now, here we are going to play an important trick the mean or the average signal energy is of course, computed as you keep observing the constellation points assuming that the constellations are IID by the way then you can use I mean of course, even otherwise you can use ergodicity that is time averages and frequency averages match that is in order to compute the average energy of a constellation you do not need to observe a very large sequence of constellation points that are realized you can just probabilistically find the average energy of the constellation and because these you know random processes that are generated by these symbols are ergodic the average energy of your modulated signal will be equal to the average energy of the constellation directly computed from the constellation itself. So, in that sense you know the it is much easier to just look at the constellation and determine the amount of energy that the constellation essentially has. Similarly, from our discussion on signal spaces we are not going to repeat, but n k samples are also IID Gaussian because of the same orthogonality related discussions that we had and therefore, the signal level SNR we are going to assume is equal to the received constellation SNR that is whenever you have the received constellation which has all your noise and all those we are just going to assume that the SNR is essentially the same because you are performing processor you are like doing match filtering and sampling and you are performing those processes that do not add any noise. So, the SNR which was there before you did your receiver operations will be the SNR even after you get back the sample points and you want to decide which constellation symbol was sent. Let us now do the most basic symbol error rate calculation before we actually go here we will be using our standard recipe if you remember we did this recipe in the context of you know symbol errors when we just discussed modulation that is if you have let us say two constellation points let us say two constellation points over here and let us say that you know the distance between these is D and along this axis you have noise which has mean 0 and sigma square as variance. If you have this right remember that the optimal decision region we did we did this optimal decision region for various constellations when you have just two the optimal decision region is basically if it is closer to one it is this particular if it is closer to the other it is the other this is because in the when we have Gaussian noise there is a e power minus you know x minus x r minus x the whole square and you have to minimize that therefore you choose the point which is the closest to the constellation point that you have therefore if you actually send this then the probability that you would make an error is how you would essentially you place a Gaussian sitting here and this Gaussian would essentially have a small probability that it will push it across the decision region. Similarly there is a Gaussian here which will which will essentially there is a Gaussian sitting there with a small amount of probability it may push it across to the other decision region. Now in this context you will remember that there is Q of D by 2 sigma which was the probability of error symbol error in this case for both of them assuming both are equi probable if you do not remember it is very simple there is a Gaussian sitting here let us without loss of generally assume this is 0. So, the problem happens if the realization of this particular Gaussian which is n of 0 sigma square is more than D by 2 therefore we have to evaluate the integral D by 2 time to infinity 1 by sigma root 2 pi e power minus let us say z square upon 2 sigma square d z. Now here if you remember of course we did it for the general case where it was not 0 mean and everything, but the trick we played was we substitute let us say y is equal to D by sigma that will give us integral D by 2 sigma to infinity 1 by root 2 pi e power minus z sorry this should be y square by 2 let me just grab my eraser. So, I will grab my eraser and erase this and I will grab my pen y square by 2 d y, but this is the integral the tail integral of a standard unit variance 0 mean Gaussian and this is referred to as our Q function it is D by Q of D by 2 sigma. So, this Q of D by 2 sigma is an important recipe that we will use whenever we have a pair of constellation points which are separated by a distance D then Q of D by 2 sigma is the probability that you will make an error this and assuming that both are equally likely we are going to stick to equally likely for the purposes of this discussion. Let us now look at this particular constellation this is the so called DPSK or binary phase shift key in constellation you have seen this in the we have referred to it as binary signaling and binary signaling with equal energy pulses. So, essentially we choose this is D a D distance over here we choose these to be root E minus root E s and root E s why do we choose it to be minus root E s and root E s. If you remember we just discussed that the symbols are going to be something like plus 1 minus 1 or let us say plus a minus a or something like that and if we have equi probable plus s and minus s rather than look at the number of plus s and minus s that come you know that the plus a will appear with probability half minus a with appear with probability half our base pulse had unit energy. So, the signal energy when you send plus a is a square signal energy when you send minus a is minus a the whole square which is again a square. Therefore, choosing the constellation points as root s and minus root E s means that my signal has average energy of E s that is meaning the energy per symbol is essentially E s which is why we choose this particular letter. In other words if you see if this guy is sent this particular symbol is sent the average energy is E s. So, and the probability with which you send is half if this particular thing is sent again the average energy is E s the probability with which you send it is half. So, this constellation has an energy E s. So, I have chosen the constellation points so that the energy of this particular constellation when you use it with our base pulse will be E s. The similar rate we can use our favorite q of d upon 2 sigma formula the d over here is the distance between these two points and it is 2 times root E s that is 2 times root E s and if you remember our always our noise was chosen to have n naught by 2 variance along each dimension. So, in the case of BPSK which means plus E root E s and minus root E s as real signals sigma square is the amount of noise we refer to that as n naught upon 2 ok. So, we refer to that noise as n naught upon 2 and therefore, if you plug it into your q of d by t sigma formula you get 2 root E s that is your d divided by and you have 2 times sigma is root of n naught upon 2 and not surprisingly that is what results in this particular expression for symbol error rate. Therefore, the symbol error rate for this kind of binary signaling where you use BPSK is q of root of 2 E s by n naught. Now, there is something which I would like you to just notice this is because we have chosen our constellation is plus root E s and minus root E s just a remark in the case where you have this particular constellation where you have a 0 and some other symbol. In this case if you want your constellation to be you know to have the correct energy of E s right you should not put E s here you should actually put root of 2 E s do you know why because if you choose this to be alpha then if you find the average energy it is half times 0 square plus half times alpha square which is equal to alpha square by 2 which is equal to E s therefore, what you will have is alpha will be root of 2 E s and in this case the d will be root of 2 E s. So, you can verify that for the same energy choosing this kind of constellation where one particular symbol is at 0 and the other is at root of 2 E s will have a different performance. In fact, it will have a slightly poorer and you know higher symbol error rate than this particular approach that is intuitively given an energy budget your aim is to separate the points as far as possible that should be your goal ok. Next let us look at pamphor in the case of pamphor I have written some numbers here, but I want to get those numbers from first principles. So, let us actually just work it out. So, let us do this for pamphor ok. So, a pamphor constellation essentially looks like this and I think it is not surprising you would not be surprised to see that you know a pamphor is generally equi-space because like I told you in the case of VPSK it is better to choose minus root E s and root E s rather than 0 and root of 2 E s with the same principle in mind I am going to choose my points as let us say minus 3 minus 1 1 3, but I want to bring the notion of energy here. So, I will call this minus 3 alpha minus alpha alpha 3 alpha ok and all these points are equiprobable and my aim is to find alpha you have to find alpha so that this particular constellation has an energy E s. So, E s is like the signal power ok. We want to design our constellation so that the resulting S of t which you know X of t which we get after modulation has energy E s. So, in this case 4 symbols all 4 equiprobable therefore, if you send minus 3 alpha power is minus 3 alpha the whole square probability is 1 by 4 let us say I am going to say energy is equal to plus minus alpha the whole square probability of sending that is one fourth plus alpha square divided by 4 and 3 alpha whole square divided by 4. So, this means I get 9 alpha square plus alpha square plus alpha square plus 9 alpha square divided by 4 and plus 9 18 18 20 I get 5 alpha square is equal to E s. Therefore, alpha is equal to root of E s upon 5. In other words if I substitute alpha as root of E s upon 5 I will end up getting a PAM 4 constellation I am going to call this PAM 4 I will end up getting a PAM 4 constellation that has energy E s ok. See how I did the calculation I had equiprobable I had equiprobable basically 4 symbols and I had them spaced smartly around 0 symmetrically if I am I mean you can verify that any other movement of the constellation will result in you wasting some power and getting a higher symbol rate for the same E s. So, if you are given an E s this is the way you should lay out your PAM 4 constellation to minimize the symbol error rate under equiprobable signaling. So, root E s upon 5 is the alpha. So, my 4 constellation points are minus 3 root E s upon 5 minus root E s upon 5 and so on and that is exactly what I have written over here minus 3 ok I have written it as root E s upon root 5 it is the same thing minus 3 root E s upon 5 minus 1 root E s upon 5 root E s upon 5 3 times root E s upon root 5 to verify that the average energy is correct I have I just square and add all of these and divide by 4 E s times basically the same thing I did with the root 5. So, it is like this will give me 3 square is 9 9 and 1 10 10 and 20 20 upon 5 or this should be square root sorry yeah 20 upon 5 is 4 and 4 upon 4 is 1. So, I get E s. So, notice how I have laid out the constellations so that the energy conditions are honored. Now, time to do bit error rate calculation. Now, in this case for bit error rate calculation there are couple of scenarios the edge most symbol minus 3 upon root 5 is very nice it has a symbol error is encountered when you send it and it crosses the decision boundary that is great, but for this particular second one and the third one it can cross 2 decision boundaries one on the left and one on the right. So, this is a tricky situation. So, how do we handle this? So, let us actually do the calculation over here. So, let us say this is spam 4. So, I have minus 3 root E s upon root 5 and I am just zooming in. So, I just have minus root E s upon 5 is under root and root of E s upon 5. Now, let us do it for this one. So, for this this is decision boundary these 2 should be the same height bear with me this is D. For this particular symbol it is very simple our recipe is Q of D upon 2 sigma and we know it is a real signaling sigma is sigma square is n naught by 2 no problem what is the D? It is very simple it is the distance between these 2 symbols this is minus root E s upon 5 this is minus 3 root E s upon 5 the D is 2 times root of E s upon 5. Then if you now want to find the symbol error probability for this it is very simple we do Q of D upon 2 sigma. So, D upon 2 is E s upon 5. So, you get root of E s upon 5 n naught by 2. So, 2 E s upon 5 n naught again remember it is sigma is root n naught by 2. So, I have written this as 2 E s by 5 n naught over here this was the easy part. But the difficult part is not difficult, but it is here you have minus root E s by 5 going into error in this region and going into error in this region even though I have drawn it unsymmetrically the symmetric you have to bear with me. Now, to handle the error for this right it is very simple there are 2 different probabilities of error and these 2 different probabilities of error basically errors happening are mutually exclusive. So, you can just add it up if you really want to do it from first principles I will basically tell you how you can do it and then I will just give you the intuitive solution also. So, I add a new page. So, now let us just do it from first principles essentially you have. So, let us say this is the what is important is for us to have the D also. So, let us say that this is minus D upon 2 and this is D upon 2 let us say and you are essentially crossing let us I am basically centered by Gaussian around 0. So, essentially crossing D by 2 crossing minus D by 2. So, the probability of symbol error under this scenario is integral D by 2 to infinity 1 by sigma root 2 pi e power minus z square by 2 sigma square D z plus integral minus D upon 2 to minus infinity why because the first one handles this part, second one handles this part therefore, you have to just write this again 2 pi e power minus z square by 2 sigma square D z therefore, what you end up getting is not surprisingly q of D upon 2 sigma plus q of D upon 2 sigma why because you can either use for this particular integral you can either use a substitution saying you know if you use z is equal to y upon sigma here use z is equal to minus y upon sigma here these 2 integrals will be the same or even intuitively by the symmetry of the Gaussian you end up getting this particular integral these 2 particular integrals being the same. So, this ends up being 2 times q of D upon 2 sigma which again is the same as 2 times q of I believe root of 2 e s by 5 and not. So, now if we go back we say I have labeled it as minus 3 and 3 it is actually minus 3 by 5 root e s I do not want to do that if you look at minus 3 and 3 both of them have this one particular decision boundary where they can cross and produce an error. So, you get probability of error given minus 3 and probability of error given 3 is sent as q of root of 2 e s upon 5 and not, but in the case of minus 1 times e root e s by 5 and plus 1 times root e s by 5 there are these 2 blue events of error happening both of them have the same weight and it is not surprisingly both of them we just showed are q of root of 2 e s by 5 and not. Therefore, these 2 are 2 times that is the probability of symbol error in this particular constellation is not equal for all symbols some constellation points have higher symbol errors other constellation points have lower symbol error rates. Now, to find the average symbol error rate what should you do? You have to just multiply by the probability of each of these constellation points occurring in our case they are equally likely. So, the answer to the average probability of error will be it will be q of root of 2 e s by 5 and not upon 4 plus q of root of you know root 2 e s by 5 and not upon 4 plus 2 times root of q of 5 you know 2 e s by 5 and not upon 4 plus again the same thing and if you compute it you will end up getting 3 by 2 root of 2 e s by 5 and not ok. Now, not surprising not surprisingly you will it is it will be very simple for you to see that the probability of symbol error in this particular case for the same e s and same and not is much higher than in the case of is much higher than in the case of your BPSK. The reason is because within the same amount of energy your trying energy budget that is you are packing more symbols there is more chance of error assuming that the signal to noise ratio is the same that is if you look at the case of BPSK it was root of 2 e s by n not keeping everything else the same. So, e s by n not is a proxy for SNR right. So, if e s if 2 e s by n not here it is 2 by 5 which means the integral is also going to be larger and there is this ugly 1.5 or 3 by 2 sticking in the front. So, definitely the symbol error rate for PAM 4 is much higher than the case of BPSK which is very evident from the fact that you are packing in more symbols within the same amount of energy. If you go for PAM 8 and PAM 16 and things like that you will start having really really bad symbol error rates and those constellations will work only under very high SNR scenarios. So, let us pause and in this lecture we have seen the symbol error rate probabilities for BPSK and PAM 4. We have seen how you can compute the energy of the constellations and we also have to draw the decision boundaries correctly in order to compute the similar rates. In the next lecture we will extend the same concept to the case of quadrature amplitude modulation and other constellations and look at bit error rate as well. Thank you.