 a warm welcome to the tenth lecture on the subject of wavelets and multirate digital signal processing. Recall that in the previous lecture, we had established the intimate connection between the scaling function, the wavelet function, I mean the continuous time scaling function, the wavelet functions and the two channel filter bank about which we had been discussing in a few lectures before that. Towards the end of the previous lecture, we were convinced that there is an intimate connection between designing a two band filter bank and designing a multi resolution analysis. In fact, the connection is so strong that when one knows the impulse response of the low pass filter in the filter banks that we have been looking at, one can by iterative convolution obtain the scaling function and having obtained the scaling function, one can obtain the wavelet function. So, it is a very powerful reason to study the two channel filter bank in great depth and that is exactly what we intend to do today. Let me put before you the theme of the lecture today. So, today we intend to talk about the z domain analysis of the multirate filter bank and to do that, we shall begin by considering the basic operations of the multirate system. Namely, down sampling and up sampling. The rest of it is known to us from a basic exposure to discrete time systems, but how to deal with multirate operations is what we need to understand much more carefully in the next few minutes. So, let us once again draw the structure of the two channel filter bank, which we have been looking at in some of the previous lectures. Recall that the two channel filter bank has an analysis component and a synthesis component. We had given the following nomenclature for the analysis and the synthesis side. I shall just recapitulate that. So, on the analysis side, we have two filters, the low pass analysis filter and the high pass analysis filter followed by down sampling operations. On the synthesis side, we have first the up sampling operation followed by the synthesis low pass filter and the synthesis high pass filter. And you will recall that the outputs of these two were added and this constituted the overall output. So, we have the input here and the output here. To recall, this is going towards the ideal discrete time low pass filter with a cutoff of pi by 2 on the normalized angular frequency axis and so is this. This is going towards the discrete time ideal high pass filter with the cutoff of pi by 2 again and so is this. This is what we call the analysis side of the filter bank up to here and this is what we call the synthesis side. When I mark this, I mean all this. So, maybe we should put a dotted boundary around. So, this is all the synthesis side and this is the analysis side. Anyway, with this little recall of what we did in the previous lecture, let us identify what it is in this filter bank, which is unusual, which is beyond what one normally is exposed to in a basic course on discrete time systems. If you look at it carefully, there are two unusual blocks here and they are the down sampler and the up sampler. So, the unusual or the new blocks, the down sampler and you know what the down sampler did. When you had a sequence indexed by the integers, so let us say it is indexed by 0, 1, 2, 3, 4, 5 and so on and of course, minus 1, minus 2, minus 3 and so on on this side. The down sampler lets the 0 sample go to the point 0, the 2 sample to the point 1, the 4 sample to the point 2 and so on so forth and on this side, the minus 2 sample comes to the point minus 1 and so on so forth. So, in a certain sense, the down sampler is both a remover of some samples and a compressor of the remaining samples. There are two steps in down sampling, if you think about it and we shall in fact, analyze the down sampler treating it as a cascade of two steps. So, to state it clearly, a down sampler first kills some samples. So, for example, if I go back to the same indexing 0, 1, 2, 3, 4, 5 and so on here and minus 1, minus 2, minus 3, minus 4 and so on there, then 0 is as it is, 1 is reduced to 0, 2 is as it is. So, when I write the number in brackets, what I mean is this sample is brought forth as it is and when I write 0 here, what I mean is this sample is made 0. So, this is made 0, 4 as it is, 5 is made 0, minus 1 made 0, minus 2 as it is, minus 3 made 0, minus 4 as it is and so on so forth. This is the first step. The second step is to compress. So, it first kills some samples, then the second step is compresses the resultant. So, you have 0 where it was, then a 0, 2 where it was and then a 0, 4 where it was and then a 0 and so on so forth here. You have a 0 in place of minus 1, then a minus 2 where it was, 0 in place of minus 3 and so on so forth here and the compression brings 0 to the 0.0, this to the 0.1, 4 to the 0.2 and so on so forth and here it brings minus 2 to the 0.1 and so on so forth. So, there is a so called compression taking place, a removal of the unwanted zeros. Now, when we do a z domain analysis of this, we shall do it precisely in these two steps. Let us, before we proceed to the z domain analysis, look at the second unusual block here. So, second unusual block is the up sampler and we have denoted up sampler by up arrow followed by 2 and you know what the up sampler does. If you have a sequence indexed by 0, 1, 2, 3, 4, 5 and so on so forth and of course, to continue minus 1, minus 2, minus 3 and so on so forth on this side, the 0 sample goes where it is to 0, the 1 sample goes to 2, the 2 sample goes to 4, the minus 1 sample goes to minus 2, the minus 2 to minus 4 and so on so forth. So, what we will do is, we will put these in brackets now and we insert zeros in between. So, in other words, we expand in some sense and up sampler also expands in some sense. So, some people like to call it as a spander also because it in some sense out does this last step that a down sampler does. You know, if you think about it, this last step which a down sampler does namely compresses by removing zeros is out done by the up sampler. We should make a note of that, it is important. The up sampler out does the last compression step of a down sampler. Hence, it is also called an expander. Now, I must emphasize that the up sampling operation is invertible. So, even the original sequence is unaffected by the process of up sampling. You can get back the original sequence after up sampling it. The same is not true of down sampling. When you down sample, you lose some information forever. So, in a certain sense, you know down sampling first as I said kills some samples and then also compresses in some sense covers up that killing part, if you want to call it that by removing evidence of the zeros that have been created. What the up sampler does is to put back the zeros where they were as if you are recreating the evidence of killing in a lighter vein of course. Whatever it be, the up sampler takes you from a lower rate system to a higher rate system and the down sampler takes you from a higher rate system to a lower rate system. So, when you down sample, you are actually changing the effective sampling rate. You know if you think about it, in down sampling what are you doing? You are retaining one out of every two samples and in principle what time you allocate to processing each of these samples after down sampling is up to you. What is practically done in most discrete time systems is when down sampling takes place, one allows more time to process samples after down sampling. So, in a certain sense that down sampling and up sampling operation is taken care of by having different clocking rates at different points in the system. You know what we are saying in effect is the same system has different effective sampling rates at different points and to emphasize this point let us go back once again to that two channel filter bank that we drew a few minutes before. You know if you look back at this two channel filter bank here, what we are effectively saying is that there is one sampling rate operating here at the input and the same sampling rate operates here at the output. However, although those sampling the sampling rate here and the sampling rate here which are the same also operate after these filters and before and after these filters. They do not operate here you know. So, at this point after the down sampler and before the up sampler and after the down sampler here and before the up sampler we have effectively a different sampling rate. In fact, the sampling rate here is in principle one half of the sampling rate here and that is why this is called a multirate system. Now it is clear why we are talking about multirate systems. We have two different sampling rates in the same system. Now one can generalize this you can have more than two sampling rates in the same system. In fact, you know you might have different kinds of down sampling and up sampling operators. So, let us expand our view in that sense now. So, in general one could be talking about up sampling and down sampling by a factor of m. So, to speak and that is not too difficult to understand now that we have written down what down sampling by two means and what up sampling by two means. So, let us write down down sampling by m in general which of course, we denote by down followed by m. So, let us again take an example for clarity. Suppose we take m equal to say 5 you know to bring in some variety. So, I have these samples here 0 1 2 3 4. Now what I am writing here please remember are the indices of the samples not the values of the samples. So, 0 1 2 3 4 5 6 7 8 9 10 and 11 and so on. And similarly on this side minus 1 minus 2 minus 3 minus 4 minus 5 and so on. What do we do in down sampling by a factor of 5? The first step is to kill some of the samples. So, 0 sample is kept where it is the 5 sample is kept where it is the 10 sample is kept where it is the minus 5 sample is kept where it is, but all the other samples the 1 sample 2 sample 3 sample 4 sample the sample number 6 7 8 9 are all reduced to 0. So, also minus 1 minus 2 minus 3 minus 4 all of these are reduced to 0. So, this is the killing step. So, to speak and then the compression step. So, the compression step would bring the 0 sample to the position 0 the 5 sample to the position 1 the 10 sample to the position 2 the minus 5 sample to the position minus 1 and so on so forth here. And remember there are 0's in between here which are simply thrown away 0's thrown away. So, now we understand how to generalize down sampling. In a similar way we can generalize up sampling. So, suppose we have up sampling by m which we did not up arrow followed by m and once again for variety let us take the example of m equal to 7. So, you have this sequence 0 with indices I mean 0 1 2 3 4 and so on so forth and minus 1 minus 2 minus 3 and so on so forth here. When you up sample by 7 the 0 sample goes where it is to 0 the 1 sample would go to 7 the 2 sample to 14 and so on so forth the 3 sample to 21 the 4 sample to 28 and the minus 1 sample would go to minus 7 minus 2 to minus 14 and so on so forth. And of course, in between. So, I will put brackets around these just for clarity here in between you would insert 0's. So, how many 0's would you insert here 6 0's here to 6 0's in between here also 6 0's and so on. So, this is up sampling by a factor of 7. We understand now how we can generalize both down sampling and up sampling and now what we need to do is to analyze these operations from a transform perspective. So, in the transform domain which transform of course, we will first begin with the z transform because it is easier to understand the effect in the z domain and then go into the frequency domain by substituting z equal to erase the power j omega. Now, you know it is easier to understand the effect of up sampling in fact by a general factor of m in the z domain. So, let us begin with that let us consider a general factor of m up sampling by m most generally. What we do when we up sample by m that is easy you see the original sequence is x of n. So, this is the input after up sampling by m let the sequence become x u of n. Now, we can write down x u of n explicitly in terms of x of n. In fact, instead of doing that let us straight away go into the z domain. So, let us consider the z transform of x u n that is easy summation n going from minus infinity to plus infinity x u n z raise the power minus n and the only catch is among all these n's only those n's have a non-zero sample which are multiples of capital M. And therefore, we can rewrite this summation here as summation again let us say k going from minus to plus infinity x of k. Now, remember x of k occurs at the point m times k in x u m. And therefore, here we have z raise the power minus capital M times k coming up. Now, this is a familiar expression this is very light the z transform of x except that you have replaced z by z raise the power capital M. So, in fact there we have a very simple relationship for x u z to x z indeed the z transform of the sequence x u n namely x u z capital X u z is the z transform of the sequence x u n x with z replace by z raise the power M simple. Now, in fact this also brings before us very clearly the invertibility. So, just as you can say x of x u of z is x of z raise to the power capital M you can also say capital X of z is x u z raise the power 1 by z raise by M. So, what we are saying in effect is that this operation of sampling by M you know this operation is invertible clearly shown here clearly evident whether we look at it in the time domain or whether we look at it in the z domain this property is evident the invertibility very soon we shall look at the down sampling operation and there we shall also see the non invertibility evident in the z domain perhaps not as evident, but evident all the same. So, let us now go to down sampling now as I said down sampling is a concatenation of two processes in one process we kill some samples in the second process we compress the so called partially killed sequence this process of killing some samples is what requires a little bit of effort to express in the z domain and here we shall not attempt straight away to jump to generalization to any capital M we shall instead take capital M equal to 2 illustrate the idea and then allow for a generalization to any other capital M. So, let us proceed then with down sampling by a factor of 2 now first. So, here we are when we wish to down sample by a factor of 2 what we are saying in effect is we are killing every other sample and how do we kill one way to kill is to multiply by a killing sequence so to speak. So, when we consider down sampling by a factor of 2 the first killing step can be viewed as a modulation step or multiplication by another sequence by killing sequence let us call it instead of giving such a violent name maybe we should call this a window sequence that is a milder name you know what does a window do a window allows you to see a certain part of the scene outside in a certain sense when we retain some samples and destroy all others that is exactly what we are doing we are allowing those samples that are retained to be passed through the window and those that are destroyed to be stopped. So, if you wish we can call this sequence that keeps some and removes the others as a window, but a window periodic sequence you know I use the word window periodic sequence because the window sequence name has also been used in the design of finite impulse response filters and the window periodic sequence has the following pattern at the point 0 it takes the value 1 at the point 1 it has the value 0 and then periodically thus and the same on the negative side periodically continued on both sides. So, you know you can think of it as a periodic window where wherever there is a 1 you are allowing the scene to pass and wherever there is a 0 you are stopping the scene. Let us call this periodic window sequence p w n where the p is to denote periodic and the w subscript is to denote the window behavior. So, this is a window periodic sequence for down sampling by 2, but you can have a similar window periodic sequence for down sampling by any other factor. So, suppose you were to down sample by m in general again let us take the example now of a variety of m equal to 4 this time then the corresponding p w n would be 1 located at 0 then 3 0s 1 located at 4 then 3 0s again 1 located at 8 and so on on this side and of course 3 0s and then 1 and so on on this side periodically continued continued this way continued this way. So, what we are saying in effect is the process of killing the killing process is essentially multiplication by p w n for the appropriate m. So, if you want to down sample by 2 you have an appropriate p w n periodic with a period of 2 with 1s located at all multiples of 2 and 0s elsewhere. In general when you want to down sample by m you have a periodic sequence p w n with a period of capital M 1s located at all multiples of capital M and 0s everywhere else simple enough what about the compression step the compression step can be viewed as an inverse expander an inverse upsampling step. So, maybe we should say down sampling by m means or in the words let us actually put down sequences here let us say x n has been down sampled to produce x d n and that means x n has first been multiplied by p w n p w n for down sampling by m for m in brief and then now now look here you know what we are saying is x d n is here I am saying up sample by m, but this way that means it is an reverse or it is an inverse upsampling operation. Now, if we view the down sampling operation this way it is again very clear why it is not invertible this part is invertible, but this part is not because you cannot divide by p w n p w n has 0s in it you cannot divide by them that is another way of viewing it and of course, this will also get manifested in the z domain, but certainly now you know to manifest this in the z domain this operation of multiplication by a sequence is difficult to capture in the z domain. So, what we need to do is to translate this multiplication by p w n into multiplication by other sequences which are easy to interpret in the z domain. Now, the only convenient multiplication by sequence operation which can be handled in the z domain is multiplication by an exponential. So, what we need to do is to replace this multiplication by p w n by a linear combination of multiplications by exponentials how do we do that? So, let me put down our objective little more clearly this multiplication by p w n needs to be replaced by x n multiplied by exponential alpha 1 to the power of n. So, I think maybe you know I will say multiply by alpha 1 to the power n plus say alpha q to the power n q such terms same x n. So, you know multiplication by alpha 1 to the power of n or alpha to the power of n in general is easy to handle in the z domain. So, the other way of saying it is we need to express we need to express p w n as a linear combination let us say c k times alpha k to the power n. Let us say c k times alpha k to the power n k going from let us say 1 to q now you know this is not at all difficult to do. In fact, if you think about it that is exactly what the discrete Fourier transform does in discrete time signal processing the discrete time Fourier transform essentially expresses a sequence. In fact, a periodic time limited sequence as a combination of exponentials. Let me just to refresh our ideas put the expression for the inverse discrete Fourier transform before us. So, if you recall you know if you have a limited a time limited sequence let us say it has capital N samples. So, you know you have let us give the sequence a name b 0 to b n you know or b n minus 1 to be more precise. So, if this is the time limited sequence of capital N samples it is discrete Fourier transform if you recall is essentially capital B of k. Of course, k also running from 0 to capital N minus 1 with capital B of k defined by summation n going from 0 to capital N minus 1 b n e raised the power minus j 2 pi by n capital N times n k. And then we can reduce the time limit we construct b n from its discrete Fourier transform that is easy b n is 1 by n summation k going from 0 to N minus 1 capital B of k e raised the power j 2 pi by n k n. Now, this is true for again n going from 0 to capital N minus 1. But after all if you recall what we have here in the discrete Fourier transform expression and in this expression which is essentially an inverse discrete Fourier transform. Recall that the discrete Fourier transform is often abbreviated by DFT and the inverse discrete Fourier transform by IDFT. In the IDFT we have exactly the kind of expansion or expression that we desire. We are expressing that limited sequence of capital N samples in terms of its DFT components and exponentials here. So, we have exactly what we want. Now, we can exploit this you see what is to be noted here is that although we have talked about a limited sequence actually you can periodically extend that sequence in capital N. And whatever expression we have here to reconstruct the b n from capital B of k. So, b n is reconstructed from capital B of k here seemingly only at n equal to 0 to capital N minus 1. But even if you apply the same expression for all integer n you get a periodically repeated sequence whatever is between 0 and n minus 1 is periodically repeated in every interval of n successively and before. And that is easily seen if you substitute n by n plus any multiple of capital N here noting that e raise the power j 2 pi by n times capital N is 1. Let me do that just for completeness. So, what I am saying is if we use this expression the expression summation k going from 0 to capital N minus 1 capital B of k e raise the power j 2 pi by n k n generates a periodic sequence. So, let us call this expression as a function of n be till day n. It is very clear that be till day n plus l times capital N is essentially summation k going from 0 to capital N minus 1 B k e raise the power j 2 pi by capital N k n plus l times capital N. And this can be simplified if k going from 0 to capital N minus 1 B k e raise the power j 2 pi by capital N k n times e raise the power j 2 pi l and this is essentially 1. So, this is essentially 1. So, you may remove this term and leave this and that is the same as be till day n. And therefore, what we are saying is in effect be till day n plus l times capital N is be till day n for all n and therefore, periodic with period capital N. So, here we have a mechanism for generating a periodic sequence by using a combination of exponentials. Let us exploit that. So, let us now take the case of capital M equal to 2. There it is easy. We need the periodic sequence well 1, 0, 1, 0 and so on and so forth. And we exploit just one period here and we construct the discrete Fourier transform of this. That is easy. It is 1 times e raise the power minus j 2 pi by 2 times you know of course, a discrete Fourier transform is a function of the frequency index k. So, this is 0 times k plus 0. So, in fact, B of k is 1 for k equal to 0 and 1. And how do we reconstruct the sequence? The periodic sequence P w n then for M equal to 2 is reconstructed using the inverse discrete Fourier transform. So, it is summation k going from 0 to 1, B k e raise the power j 2 pi by 2 times k n and that is easy to do. That is half summation k going from 0 to 1, 1 times e raise the power j 2 pi by 2 is j pi k n. So, in fact, let us expand it explicitly. So, that is half with k equal to 0 it is 1 raise the power of n plus minus 1 raise the power of n. And now, we are well set. In fact, we are almost there. Indeed, what we are saying is if you have x n and if you are multiplying this by this sequence and you wish to obtain the z transform here, all that you need to do is to say express the following expression n going from minus to plus infinity x n into half 1 raise the power of n plus minus 1 raise the power of n times z raise the power of minus n in the z domain which is easily seen to be summation n going from minus to plus infinity of course, half can be brought out everywhere x n z raise the power of n plus half summation overall n from minus to plus infinity x n minus z raise the power minus n. So, we have done our job. Indeed, these are very familiar expressions. This is just the z transform of x and this is the z transform of x with z replaced by minus z. So, we have this is essentially equal to capital X evaluated at z plus capital X evaluated at minus z multiplied by half. So, we have done our job. Now, all that we need to do is to note that this goes through an inverse up sample up sampler by 2. So, to speak and therefore, if we put these together we have the final result x n with z transform capital X of z when it goes through a down sampling by 2 becomes in the z domain x d n with the correspondence of x d n with the corresponding z transform given by half x z raise to the half plus x minus z raise to the half. We have done what we wanted to in this lecture. We have established the z transforms of the basic multirate operations in terms of the original z transforms of the sequences. We shall build on this further in the next lecture to carry out the complete analysis of the two channel filter bank. With that then we conclude this lecture and look forward to the complete analysis. Thank you.