 So, welcome back 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 with a signal space picture in mind. So, if you remember in the last lecture we were talking about how you can obtain a set of orthonormal basis vectors, basis signals from a set of S1, S2 up through Sm, Sm minus 1 rather S0, S1 up to Sm minus 1 and you need to obtain a set of orthonormal basis signals. To do this we need to use the Gram-Schmidt orthogonalization process which takes the first signal, finds the component of the second signal that is not along the first signal to get a new signal, finds the component of the third signal that is not along the first two and repeats at the end you get a basis, you get a basis set. So, let us actually do this for a specific example. So, in this particular example you have four signals I have not used the S0, S1 notation in this case S1 of t, S2 of t, S3 of t, S4 of t, S1 of t is essentially 1 from 0 to 2 seconds, S2 of t is 1 from minus 1 to 1 second, S3 of t is 2 from 0 to 1 second and S4 of t is minus 1 from 0, minus 1 to 0, 1 from 0 to 1 and minus 1 to 2. So, let us now see how you can perform the Gram-Schmidt orthogonalization for this. I will make a remark the resulting orthonormal basis depends on which signals you choose in which order we are going to choose them in this order 1, 2, 3, 4. If you choose another order you will get a different basis set that is also equally correct and there is no problem the basis set that you get from Gram-Schmidt orthogonalization is not unique alright. So, let us actually perform Gram-Schmidt orthogonalization on these signals for reference I have put them over here S1 of t, S2 of t, S3 of t, S4 of t all we need to know is where they are non-zero. So, our basically times of interest are between minus 1 second and 2 seconds, the first signal is non-zero between 0 and 2, the second is non-zero between minus 1 and 1, third is 2 between 0 and 1, the fourth is like minus 1 in the first interval, 1 in the second interval, minus 1 in the third interval. Let us now carefully perform Gram-Schmidt orthogonalization on this signal set alright. So, now what we are going to do is we are going to first take our psi 1, let us make it blue so that you know it is nicer ok, let me rewrite it over here. So, I am going to write psi 1 of t directly and psi 1 of t let me just get rid of this because it is confusing yes. So, psi 1 of t is going to be S1 of t by norm S1, this is very easy because I am just going to choose my first signal as my first orthogonal vector or first basis element, but just scale it to make it unit energy. So, if you now look at inner product like in like norm of S1 that is very easy if you just calculate integral S1 square of t I am dealing with real signals minus infinity to infinity. It is very evident that you can see that it is over here it is 1 from 0 to 2 so this integral is going to be 2. Therefore, my psi 1 of t if I draw it is very simple between 0 to 2 it is it is like this is actually norm S1 square. So, if you substitute norm S1 over here it is 1 upon root 2 so this ampere will be 1 upon root 2. So, we have our psi 1, the psi 1 is just a scaled version of S1 it is just S1 except that it is being scaled to have unit energy so that is your psi 1. So, now the next task is to obtain psi 2 to obtain psi 2 we will first go for an intermediate function called phi 1 that essentially find your that essentially finds you a signal that is orthogonal to psi 1 ok, but has the rest of S2 in it. So, let us do that. So, I am going to define phi 2 of t as S2 of t minus inner product S2 comma psi 1 times psi 1 of t. So, this is actually very interesting the first part says phi 2 is S2, but I want to take out that part of S2 that is along psi 1. So, now needless to say if you find inner product phi 2 comma psi 1 that is equal to inner product of S2 comma psi 1 minus inner product S2 psi 1 remains because it is a number inner product psi 1 psi 1, but what is inner product psi 1 psi 1? Inner product psi 1 psi 1 is 1 because we chose it in that manner it is S1 by S1 of t by norm S1. So, this goes away. So, if you now subtract you get this equal to 0. In other words phi 2 is a signal that is specifically designed to be orthogonal to psi 1 and have the remaining part of S2 in it. Let me issue a warning over here. If S2 of t is actually just a scaled version of S1 of t then you will get phi 2 to be 0 which is completely fine in which case you can just ignore it and move on to the next signal because phi 2 is just a scaled version of you know phi 2 you know you are just a scaled version of S1. So, if your S2 is just a scaled version of S1 everything is going to be captured over here and you are essentially going to get 0. So, that is something you have to keep in mind. I am going to keep this part over here. So, let us now move further. I want to find phi 2. So, phi 2 is S2 of t minus S2 times psi 1 times psi 1 of t. So, what is inner product S2 psi 1? So, psi 1 of t is this psi 2 of you know S2 of t is this you can see that psi 1 is non-zero only from 0 to 2 while over here this is between minus 1 to 1 and the only overlapping area is the part between 0 and 1. So, if you now perform the integral S2 of t psi 1 of t dt only the part between 0 and 1 is active and that part if you integrate you are going to get just 1 upon root 2. So, you are just going to get 1 upon root 2 that is because if you multiply psi 1 and S2 you are only going to get this particular part scaled by 1 by root 2 and if you integrate you get 1 by root 2. So, this means that your phi 2 of t is S2 of t minus psi 1 of t by root 2 and let us actually use a pictorial representation and draw it. So, it is S2 of t minus psi 1 of t times 1 by root 2. So, S2 of t looks like this I am not drawing the x axis marks. So, it is all the time and this is actually S2 of t let us subtract psi 1 upon root 2 psi 1 is over here it is 1 upon root 2 everywhere if I write it in this way it is 0, 1, 2 amplitude is half. So, if I subtract what do I get I am just going to draw the resulting signal it is 1 over here and over here over here the value is 1 and the value is here I am going to subtract it I will get half and finally, in the third part the value over here is 0 value over here is half if I subtract I get minus half. So, minus 1 half minus half. So, this is my phi 2 of t, but remember phi 2 is just a signal that has the part of S2 that is orthogonal to psi 1, but it is not unit norm. So, to get my psi 2 which is the actual basis vector element I need to just normalize this so I need to just do psi 2 of t is equal to phi 2 of t by norm phi 2. So, if you want to do this integral of phi 2 square it is very easy to quickly do it amplitude here is 1. So, and this is 1 in length. So, it is 1 square similarly plus half square plus half square. So, it is 1 square plus half square plus half square. So, let me just write it down integral phi 2 square of t is equal to 1 plus 1 by 4 plus 1 by 4 that is equal to 3 by 2. So, this phi 2 is actually root of 3 by 2. So, I am just going to get this as root of 2 upon 3 this to even the root times phi 2 of t. So, let us now draw our psi 2 in a very neat way psi 2 of t is essentially phi 2 which is over here except that is scaled by root of 2 upon 3. So, let us draw this and then it is half of this half of this I am deliberately not drawing the x axis points it is minus 1 0 1 2 this is minus sorry this is not minus this is a root of 2 by 3 ok. This part is half of root of 2 by 3 which you can evaluate it will be 1 by root 6 why it is half times root of 2 by 3 that is half it is like half times root of 2 by 3 is root of 2 upon 12 that is 1 by root 6 this is minus 1 by root 6. If you want to now just do a sanity check this should in the square of psi 2 should integrate to 1 if you square it over here you get 2 thirds plus 1 6th plus 1 6th at those you get 1 that is the first point second psi 2 should be orthogonal to psi 1 psi 1 is essentially the same thing between 0 and 2 psi 2 is actually anti-portal between 0 and 2. So, the overlap will be 0. So, psi 2 is an orthogonal signal orthonormal signal I mean psi 2 is a unit energy signal and orthogonal to psi 1. So, psi 2 is the second element of our basis vector fine. So, we have done psi 1 and psi 2 let us look at psi 3. So, for psi 3 we need to find psi 3 s 3 is 2 between 0 and 1. So, 2 between 0 and 1 fine. So, how do we do this now 2 between 0 and 1 let me just draw this this is my s 3 of t 0 1 value is 2 my psi 2 is here and maybe I will just try to get psi 1 ok. So, and I am just going to copy this and let us paste it over here ok. So, this is my psi 1 this is my psi 2 and we now have this s 3. So, I am going to write phi 3 first phi 3 of t is again for Gram-Schmidt remember it is s 3 without the components along psi 1 and psi 2. So, it is s 3 of t minus inner product s 3 comma psi 1 times psi 1 of t minus inner product s 3 psi 2 times psi 2 of t. So, I am not going to do this, but if you take inner product of phi 3 with psi 1 that is going to be inner product s 3 psi 1 minus inner product s 3 psi 1 and it will become 1 and anyway psi 2 psi 1 inner product is 0. So, phi 3 is orthogonal to psi 1 psi 1 and similarly phi 3 will be orthogonal to psi 2 which is what you want because you want a signal which is has that part of s 3 that is not in psi 1 and not captured in psi 2 as well. So, I am not going to do that I am now just going to find phi 3 and then make it unit norm so, unit energy so, that I get the third component. So, now let us do this. So, I have these signals over here let us now carefully just find inner product s 3 psi 1 inner product s 3 psi 2. So, psi 1 is here inner product s 3 comma psi 1 I am just going to look at the pictures and do this for you. So, if you look at inner product of s 3 and psi 1 this is 2 between 0 and 1 this is 1 upon root 2 between 0 and 1. So, the common part is only 0 and 1 and you are just going to get 2 multiplied by 1 upon root 2. So, that is going to be I think root 2 because you are multiplying between 0 and 1 the value is 2 here the value is 1 upon root 2 here. So, root 2 is the result inner product s 3 psi 2 is also easy. So, psi 2 is over here and it is 1 upon root 6 between 0 and 1 which is the area that matters. If you now perform the inner product I mean if you perform the multiplication in integration you know between 0 and 1 2 upon root 6 will be the result which is root of 4 upon 6 which is root of 2 by 3. Now your task is to subtract these out with the appropriate scaling that is inner product s 3 psi 1 times psi 1 inner product s 3 psi 2 times psi 2 ok. So, let us do this. So, inner product s 3 psi 1 s 3 psi 1 times psi 1 is going to be root 2 times psi 1 that is going to be you have psi 1 over here if it is root 2 times it is actually very easy from 0 to 2 it is 1. Similarly, root of 2 upon 3 times psi 2 psi 2 is also very easy root of 2 upon 3 times psi 2 is going to be if you now multiply this part by 2 upon 3 you get 2 by 3. If you multiply 1 upon root 6 by 2 by 3 you are going to get you have to multiply root 2 by 3 1 upon root 6 into root of 2 by 3 will give you root of 2 upon 18 root of 1 upon it is 1 third you get 1 third and then here you get minus 1 third why because it is minus 1 upon root 6 here and deliberately not writing the x axis, but we really want this is minus 1 0 1 2 minus 1 0 1 2. Now you need to add these and subtract it from s 3. So, let us actually do this if I add these I am going to get let us carefully add them in this part between minus 1 and 0 there is no contribution from the first signal. So, I am just going to write 2 upon 3 in the second part there is a contribution from here that is 1 and here there is a contribution of 1 third. So, you get 1 plus 1 third which is 4 by 3 in the third part there is 1 minus 1 by 3. So, you get 2 by 3 this is going to be the combination of these 2. Now you have to subtract this from your s 2 of t which is this. Now it is very easy to subtract because s 2 of t affects only the part between 0 and 1 and if you now subtract you have this 2 by 3 becomes negative this 2 by 3 becomes negative and this 4 by 3 is going to get subtracted from 2. So, you are going to get 5 3 of t to be minus 2 by 3 and over here you will get minus 2 by 3 and over here the amplitude is going to be 2 minus 4 by 3 2 minus 4 by 3 is just 6 minus 4 upon 3 you are just going to get 2 upon 3 this is your 5 3. So, let us yeah. So, now if this is your 5 3 which is minus 2 by 3 minus 2 by 3 you know it is like minus 2 by 3 2 by 3 minus 2 by 3 have a look at your s 4 this is actually minus 1 1 1 and your 5 3 looks a lot like s 3 and now if you want to scale this to make it unit energy this part is if you do 5 3 square this part is going to give you an integration contribution of I think 4 upon 9 this will be 4 upon 9 4 upon 9. So, you are essentially going to get 12 upon 9 12 upon 9 is going to be I think 4 by 3 4 by 3. So, you have to multiply by root 3 upon 2. So, you are going to get psi 3 of t as ok. So, 4 by 4 by 9 4 by 4 by 9 12 by 9. So, 3 by yeah 12 by 9 ok. So, if you take the square root ok this is actually going to be 4 by 3 you will have to multiply by root 3 by 2. So, let us multiply by root 3 by 2. So, this part is going to be minus 2 by 3 multiply by root 3 by 2. So, 2 by 3 multiply by root 3 by 2 this is going to give you root 3 this is going to get it is 1 upon root 3 yes. So, let us now use a eraser and cancel this rough area out yes. So, you are going to get minus 1 by root 3 root 3 minus 1 by root 3 that makes complete sense because if you now integrate psi 3 square you get 1 third plus 1 third plus 1 third that works out to 1. Now, the question is do we have to worry about psi 4. Now, in the case of psi 4 what happens is something which is very interesting it is actually just a scaled version of psi 3. So, if you take inner product of s 3 sorry s 4 comma psi 3 and if you subtract that out from s 4 you will get 0 which means s 4 is essentially a linear combination of these 3 waveforms. So, in this case you do not really you mean you do not need another you know you do not need another basis vector basis signal psi 1 psi 2 psi 3 capture this 4 signal system. So, that is something which is very very obvious and you know interesting. So, this is a full Gram-Schmidt orthogonalization process that we have performed for these signals, but there is just some there is just some extension which I want to talk about the one thing is in this particular case we were dealing with waveforms, but we could have got away with just dealing with vectors why the reason is because you have these signals, but they have a nice property in that they vary only at let us say 0 they vary only between they do not vary between minus 1 and 0 they do not vary between 0 and 1 they do not vary between 1 and 2 their values vary only at 0 and at 1. So, you can actually treat these as 3 dimensional vectors. So, for example, I can as well write this as 0 1 1 why because this is a 0 1 1 this I can write as 1 1 0 this I can write as here at 0 2 0. So, I am going to write the 0 2 0 and I am going to write this as minus 1 0 sorry minus 1 1 minus 1 we just use an eraser to correct it minus 1 0 1. So, if I now look at these vectors and if I perform Gram-Schmidt orthogonalization on these vectors as opposed to signals I will get the same set of vectors that is if you now look at phi 1 psi 1 I will actually get 0 1 upon root 2 1 upon root 2. If you use psi 2 if you look at psi 2 you are going to get root of 2 upon 3 1 upon root 6 minus 1 upon root 6 and if you look at psi 3 you are going to get minus 1 by root 3 root 3 minus 1 by root 3 you will get the same result if you use vectors also. There is one final remark that I wish to make first of all Gram-Schmidt orthogonalization is necessary when you have these kinds of signals, but of course in this case these were rectangular signals the same trick of vectorizing would work even if you had sync or some other waveforms if you can identify it carefully, but there is an interesting observation that you can make in order to not have to do all this work what is it? The signal varies only between minus 1 0 0 1 1 2. So, why do I need any other special basis vectors? Let me give you a basis set of basis vectors without having to do any such work by the way let us just try to copy this. So, let me just take this particular part ok. So, I am just going to ok. So, let me just talk about it below ok. So, now if you now look at the same set of signals that is 0 2 sorry this is 1 0 2 minus 1 1 the third one is yeah 2 0 and the fourth one is ok minus 1 1 ok. Here is a trick which we will play we will just write we will just write 3 basis signals directly what is the observation these signals do not vary between minus 1 and 0 they do not vary between 0 and 1 between 0 and 2 we just need to construct 3 set signals here are 3 set signals. So, this is another basis vector psi 1 of t is 1 between minus 1 and 0 psi 2 of t is 1 between 0 and 1 psi 3 of t is 1 between 1 and 2. So, this was a construction where you essentially just did not have to do gram print orthogonal orthogonalization and you were able to infer psi 1 psi 2 psi 3 almost by observation because if you look at this particular signal construction these are time orthogonal meaning they have no overlap in time which means that they are orthogonal and they are 1 in amplitude for 1 second duration which automatically means that they are going to be unit energy. So, in this particular basis we have the same vectors which we talked about this case will be 0 1 1 this will be 1 1 0 let me actually write them in different colors just so that you know things will be much easier to infer. So, let us choose something like a red color. So, this will be 0 1 1 because it is psi 2 plus psi 3 this will be 1 1 0 because this signal is psi 1 plus psi 2 this will be 0 2 0 because this signal is just 2 times psi 2 and finally, this signal let me just point an arrow here and this signal is minus 1 0 sorry be minus 1 1 minus 1 why it is essentially take psi 1 flip it take psi 2 keep it take psi 3 flip it. So, sometimes by observation you are able to infer a basis without having to do Gram-Schmidt as well or you can do a hybrid you can guess some of them and not get others and things like that. So, while the Gram-Schmidt orthogonalization process is a very systematic way of finding orthonormal basis vectors there are some situations where you can find basis vectors using just observation or other intuition. The basis vectors you obtain in this manner are going to be equivalent in every other way in the sense that your representation of these vectors is going to be different. For example, if you look at this particular basis vector in this basis vector for example, if you take psi 1 your original vector is going to be original vector had 1. So, it is going to be root 2 times root 2 0 0 that is going to be the representation of the original s 1. Notice that the energy or the sum square of this is 2 over here also the sum square is 2. Similarly, let us look at the second vector where is your psi 2 yeah it is a little more complicated for the psi 2 case where is the psi 2 yeah. So, your psi 2 is root 2 by 3 1 by root 6 minus 1 by root 6 now in this case this part has to cancel and you know you have to essentially you have to scale it appropriately, but if you now represent the vector in the same manner you will again find that the energy is the same. So, even though you are using a different basis all your computations and results are the same and this leads to a very important conclusion. The basis vectors themselves do not really matter because you can actually use different basis vectors depending on your convenience as long as you keep the basis vectors orthonormal their performance and all other design aspects are going to be the same. So, the conclusion from this exercise where we did this Granfinite Orthogonalization is that the first the basis vectors are the number of basis vector signals the number of basis signals psi 1 psi 2 is always going to be less than or equal to the number of signals in this case you had 4 signals, but only 3 orthonormal signals that captured this. The second thing is that these orthonormal basis are not unique you can come up with any other one for example, even if you did Gram-Schmidt Orthogonalization using this signal as the first then you will actually get 1 0 0 you know you will get the you know you will get the 1 between 0 and 1 as the first basis vector and then if you choose this one you will get the second and in fact you will get the basis vector that we wrote over here without having to do much work using Gram-Schmidt as well. So just keep these things in mind when you perform Gram-Schmidt Orthogonalization and wherever possible you can infer the orthogonal basis using your intuition or use a combination of Gram-Schmidt and your intuition whichever works best. Thank you.