 So, warm welcome to the 28th lecture on the subject of digital signal processing and its applications. We had commenced the discussion of FIR filter design in the previous lecture and we had looked at the simplest approach to FIR filter design taking a cue from how we represented irrational numbers in finite precision. The easy way to do it is simply to truncate up to a certain level of accuracy. So, for example, we agreed that we would simply allow a certain number of impulse response samples to be retained and naturally the choice would be if you were given how many samples you could retain. Then you would choose in some sense the most significant of the samples, the samples that made the most difference and intuitively the samples with maximum magnitude are expected to make the most difference. And typically in most of the responses that we notice the most important samples lie around n equal to 0 and therefore we choose a certain number of samples placed around n equal to 0 depending on what length we are permitted to make the impulse response of the finite impulse response filter. Now, we were trying to understand the consequence of this on the frequency response and we had noted that if we considered an ideal impulse response h ideal n and retain this for n between minus capital N and plus capital N, this is the equivalent to h F r r n or the impulse response of the FR filter given by h ideal n into V n where V n is a window function and of course in the specific case where we are retaining some samples and throwing out the rest, this window function is essentially just a constant in that interval. So, in this case V n is 1 for n between minus n and plus n and 0 else for more n greater than n. Now, if we sketch this sequence which is easy to do, this is the point minus n, this is the point plus n, it is 0 else and if we put around this sequence what we call an envelope like this. An envelope which when sampled at the integers results in the window, then this envelope is rectangular, it is essentially a rectangular pulse and therefore we call this a rectangular window. So far we have not seen any other window but we can of course conceive of other windows by putting other shapes in the same place. So, for example, between minus n and plus n, we could put a triangle if we desire or we could put a cycle of a cosine wave, you know you could put the cos wave displaced by its own amplitude and therefore you could have the cosine function go this way and of course we could conceive of many other windows like this. These are all examples of shapes that one can put between minus n and plus n and then sample this, you see each such shape when it is put between minus n and plus n is then sampled at every integer. So, Vn could be essentially samples of different shapes put between minus n and plus n taken at the integers. Naturally as capital N grows, the number of samples increases. In the previous lecture, although we had introduced the idea of a window, we had not seen why we should write a general sequence Vn, now we know we could have shapes other than rectangular. We had seen last time was the rectangular window, we could have other shapes. In fact, if you look at the triangular shape, it is very easy to see that the triangular shape can be obtained by convolving the rectangular shape with itself. So, if you have a rectangular shape between minus n by 2 and plus n by 2, since this is an envelope, since it is a continuous function, let us say of the variable t, let us call it V continuous t, then V continuous t convolved with itself would give us the triangular window. So, we can see there are relationships between the windows as well and that will also help us obtain the discrete time Fourier transform in case we decide to obtain it for the triangular window appropriately sampled. Anyway, whatever it be, we will agree that in all these windows, once you have sampled that envelope at each of the integers, you get a sequence that sequence is called Vn. So, Vn, let us write down what Vn is, Vn is this continuous window function, window envelope if you like to call it that, sampled, so of course we have called the continuous envelope Vct sampled at t equal to n, we will teach us n and of course Vn has a discrete time Fourier transform. Yes, please, it is a question. So, the question is if the window be other than rectangular, would it distort the original impulse response? Well, indeed it would change the impulse response samples at the points at which they are retained, but that change might as we will see shortly be for the better, right. So, it would of course change the samples, but our ultimate objective is not so much to retain the samples as to get a frequency response which is as close to the ideal as possible. And therefore, what we need to see is what effect does the choice of window have on the frequency response, not so much the raw samples. Anyway, so you see one thing is very clear, Vct needs to be an even function of t. This is because typically impulse responses of ideal filters are typically even or odd in n. So, if we take all the 4 piecewise constant ideal filters, they are all even in n. We shall see some other non-piecewise constant responses which are odd in n, but either even or odd symmetry is or you know if the impulse response is even, we call it symmetric around n equal to 0 and if the impulse response is odd, we call it anti-symmetric. So, typically we find that impulse responses are symmetric or anti-symmetric about the center and if we wish to preserve this symmetry or anti-symmetry as it is, so symmetry should be preserved as symmetry and anti-symmetry as anti-symmetry, then the window function needs to be even that is not too difficult to see. Because if it is symmetric of course multiplying by Vn will preserve the symmetry, if it is anti-symmetric it will still preserve this anti-symmetry because corresponding points on the positive and negative side of n will be multiplied by the same number. So anyway this preservation, now why is this preservation of symmetry important? We shall see that it has something very strongly to do with the phase response. In fact, we can see that right away and this also tells us why we are in the first place looking at FR filters, why are we looking at, why are we preserving symmetry or anti-symmetry and the answer is to preserve what is called the linear phase or pseudo linear phase property. The same an FR filter has a symmetric response that means its response is even in n, let FR, let HFRn be even in n extending from n equal to minus n to plus n. The frequency response HFR omega or e raised to power j omega as you please to call it would be summation n going from minus capital N to plus capital N HFRn e raised to power minus j omega n. Now of course we are assuming evenness with the underlying assumption of the impulse response being real as it is for all the ideal filters but if it is not real then we will assume that it is conjugate symmetry. So we will say in general that HFR minus n is HFRn complex conjugated for real HFRn it is simply even. Now let us look at the frequency response from the point of view of its amplitude and phase part. So HFR omega HFRn has the DTFT given by HFR let me expand it now e raised to power j omega n plus HFR minus n plus 1 e raised to power j omega n minus 1 and so on HFR0 plus and then you have HFRn minus 1 e raised to power minus j omega n minus 1 plus finally HFR capital N e raised to power minus j omega n. Now I have expanded showing some typical terms and what we do is to combine corresponding terms now on the negative and positive side. For the moment let us assume that this is real to make matters simple actually we do not really need to. Let us take in general that they are you know conjugate symmetric. So in that case each of the corresponding negative samples is going to be the complex conjugate of the positive sample and therefore we are going to have a combination of capital N terms of the following nature. This can be combined as HFR0 plus summation n going from 1 to capital N HFRn e raised to power minus j omega n plus HFRn complex conjugate e raised to power j omega n minus j omega n also complex conjugate because associated with minus you see HFR minus n is HFRn complex conjugated and the corresponding exponential term associated with it is e raised to power j omega n that can be written as e raised to power minus j omega n complex conjugated. So we have capital N such terms here. Now clearly this is the complex conjugate of this. So this term in its entirety is the complex conjugate of this and therefore the sum is two times the real part of this that is easy to see and that can be written as HFR0 plus summation n going from 1 to capital N two times the real part of HFRn times e raised to power minus j omega n and of course if HFR is real then we have a very simple expression. We have this becomes HFR0 plus summation n going from 1 to capital N two HFRn cos omega n and what is noteworthy anyway whether HFRn is real or not is that this impulse this frequency response is real in either case in any case the DTFT is real this is not worthy. Now when the DTFT is real its phase can either be 0 or pi. So this quantity this expression that we have here or this DTFT itself if you would like to call it that is also called the pseudo magnitude. This DTFT is like a magnitude except that it can be positive or negative. The phase is either 0 or pi but nothing else and therefore it is called the pseudo magnitude. If it happens to be positive all over then it becomes a magnitude the magnitude of the DTFT is itself. Now it should be noted that when you thus truncate so you know when you have taken the ideal impulse response and multiplied it by a window function to retain samples between minus capital N and plus capital N thus the corresponding FHR filter is non-causal. So we have a problem or we think we have a problem there you know if as it stands the FHR filter is non-causal but it is very easy to make it causal all that you need to do is to delay the output by capital N samples. We can easily make it causal by an N sample delay and N sample delay is very easy to understand in the frequency domain. All the N sample delay does is to impose an additional linear phase. The other way of looking at it is you are saying you have the original FHR filter you subject it to an N sample delay that means Y of N is X of N minus capital N and this introduces no change in magnitude. This is a linear shift invariant system very clearly and it is very easy to find its frequency response. The phase response simply becomes minus omega N. In fact you can write down its DTFT the frequency response DTFT of impulse response or frequency response is e raised to power minus j omega N. So it has a magnitude of 1 and a phase of minus omega N and therefore all that this does is to add a linear phase. Now of course this is not very difficult to understand intuitively. If you delay the output obviously the nature of the output is unchanged it is just going to come later and that coming later is reflected in the phase. So now we also see what happens when you have a phase response. The role played by a phase response is essentially shifting in time. If all components are shifted by the same amount in time then the phase response is transparent. All that you will see is that your output comes later. But if some components come earlier than others then you have a problem and that is what you mean by non-linear phase response. If the phase response is non-linear then some frequency components come before the others and then we have a problem then the fundamental nature of the signal changes. So obviously the desirable situation is to have as linear as possible a phase response and in fact even after thus making the FR filter causal the phase response of the FR filter is almost exactly linear. The only little bit of non-linearity is caused by the fact that the original DTFTO the original frequency response could be either positive or negative. So it is a pseudo-magnitude multiplied by a linear phase and that pseudo-magnitude is a magnitude then you have exact linear phase. If the pseudo-magnitude becomes negative at places then you have a problem that the phase becomes 0 plus a linear phase at some places and pi plus a linear phase at other places. That is much better than having non-linear phase. So this is clearly the reason why FIR filters have a great advantage over IIR filters. Unfortunately it is impossible to design infinite impulse response filters with linear phase. In fact I put this as a challenge before you. Prove that I know your rational filters if causal filters cannot have linear phase. That precludes a good phase response and we saw that in the Butterworth and the Chebyshev filters. There was a trade-off. When you went from the Butterworth to Chebyshev you would not do any worse in terms of resource as far as meeting magnitude specifications were concerned. But when it comes to meeting phase response which we have not specified at all the Chebyshev filter cannot do better than the Butterworth filter. So although the Chebyshev filter does not do worse than the Butterworth filter or might even do better in terms of magnitude specifications that means it conserves on resources to meet magnitude specifications. It unfortunately degrades the phase response and in fact as you go from Chebyshev to elliptic that is even more true though we have not talked about elliptic filter design. So this whole problem manifests itself in IR filters and in FIR filters we obliterate it entirely. We do not have a problem of phase response at all. We can get exactly linear phase and of course I told you right in the beginning when we started the engineering part of this course nothing comes for free in engineering systems. What you lose in terms of I mean what you gain in terms of phase response here you lose then in terms of resource. Ultimately a lot of engineering systems come down to the simple maximum invest more gain more. I can scarcely think they are very I mean it requires a lot of ingenuity it requires a lot of deep understanding to violate this principle into some extent. Of course we do to an extent at places but by and large it is always a game of investing more and gaining more or investing less and then also losing something. Of course the game also pertains to what you can lose. So you know sometimes you do not mind losing something and then you can gain something else and that is also game then what are you willing to lose. Anyway here if you wish to gain in terms of phase response you have to lose in terms of resource. So what typically happens is that to meet the same magnitude specifications you would have to keep a much larger length for the FIR filter and in the design exercise that has been administered to all students in this course you are of course expected to observe that. So you would be designing an IRR filter with given specifications and you would also be designing an FIR filter with the same magnitude specifications and you would compare the requirement of resource when you design it with the IRR approach and when you design it with the finite impulse response approach to meet the same magnitude specifications. But anyway we now need to complete our discussion on how you can meet a set of magnitude specifications.