In real life not all signals are band-limited. And if we sample non-band-limited signals there will be a nasty effect called aliasing. You may remember this effect in Module Two. We had seen the wagon wheel effect where wagon wheels would go backwards. Here we are going to explore this in detail, specifically with sinusoids. And we are going to see that if a sinusoid is not sampled fast enough, then it will fall back into seemingly a lower-frequency sinusoid. So there is an infinite set of sinusoids that when sampled, all looks the same in their sampled version. The [INAUDIBLE] phenomenon is very fundamental. And we need to understand it in detail. >> Module 6.4. Sampling and Aliasing - Introduction. We will see what happens if we do so-called Raw sampling. So we take any signal, we sample it. When it's band-limited, everything goes fine. When it's not band-limited, things can go wrong and we'll see specifically this with Sinusoidal aliasing. Which is a phenomenon when, sampled sinusoid actually looks like another sinusoid. Remember how we do sinc sampling. So we take a sinc function. We scale it by Ts, we shift it by n times Ts. And we take the inner product with x of t to get the sample, xn. This can be written as the convolution between sinc Ts. So we denote scaling of the sinc function by Ts at location nTs. In a block diagram we take x of T, we go through a low pass filter, an ideal low pass filter of bandwidth omega N, and we take samples every Ts seconds to derive a sequence xn. Raw sampling is when we don't care about first taking the inner product with the sinc function. So we just take xt. And every Ts seconds we take a sample xn. So you must remember the wagonwheel effect. We had seen simulated movie how a wheel could go backwards, if we were not careful about having a high sampling rate. The complex exponential is a familiar character. Now we look at the continuous time complex exponential, xt is e to the j. Capital omega naught times t. It's always periodic, it has a period 2 pi over capital omega. Note all angle speeds are allowed, so fourier transform of this complex exponential is a delta, that is seated at omega is equal to omega naught. It is obviously band-limited to omega naught. If we look at this continuous time complex exponential on the unit circle, then it is a phaser that runs around the unit circle. If we take samples of this continuous time complex exponential, so xn is e to the j, on omega naught, Ts times n. Then they're all samples or snapshots at regular intervals of this rotating point. So resulting digital frequency is small omega naught, which is equal to omega naught times Ts. Okay. So please note the difference between small omega and capital omega. When Ts is smaller than pi over capital omega 0, or small omega 0 is smaller than pi, then the phaser will advance in small steps as we can see here on this figure. When Ts is become pi omega 0 and 2 pi omega 0, that is small omega 0 is between pi and 2 pi, then the phaser advances in big steps. However this looks as if it were going in a negative direction, as you can see here, it steps in small steps, and it looks like it's going in the opposite directions than what it is actually going. Finally, when Ts is bigger than 2 pi over omega naught, or small omega naught is bigger than 2 pi, than again we think it goes in the positive direction. But it does actually don't full circle. Plus the little step. So we see that is large frequency looks actually like a small frequency. Okay, we see x1, x2, x3, x4 and so on, as if it were going in small steps. And so this large frequency actually mimics like a small frequency, and that's a phenomenon we call aliasing. Let's look what happens when we reconstruct or interpolate based on the samples we have just seen. Let's look at this in a blog diagram. So we have x of t. We sample with a sampling period Ts. Then we interpolate again with a spacing of Ts. And we get x-hat of t. What is x-hat of t, with respect to x of t? Now let's look at the output, x-hat of t, and what frequency will be reproduced. So the first case is easy. That's when the sampling period Ts is more than pi over omega naught. Why? Because we are meeting the sampling theorem and so the same frequency that went in should actually also come out. So the digital frequency in this case, digital frequency small omega naught is between 0 and pi and the output is indeed what went in, e to the j omega naught t. The second case is when Ts is in intermediate range, so between pi over omega naught and 2-pi or omega naught. The additional frequency now is beyond pi but smaller than 2-pi. So we see this in this formula here. And then the output. We'll have a different frequency than the input. Then if we can see omega one, which is equal to omega naught minus 2-pi over Ts. Okay. So there's alrea, already aliasing happening. Because you have this shift in frequency here that transforms the original omega naught into the output omega one. Finally, the red case, the third one here when Ts is bigger than 2 pi over omega naught, then the digital frequency would be beyond 2pi. Okay, now you know that frequencies are between 0 and 2 pi, so that doesn't really have a meaning except that they chose that this frequency will be folded back through aliasing. And it results in an output here, e to the j omega 2t where omega 2 is simply omega naught now taken module 2 pi over Ts. Okay. And this is definitely a different frequency than what went in. This point is so important that we are going to go through it one more time. Now, with a sinusoid, and using frequencies in hertz. Remember that we usually take frequencies in radiance. So frequency in radiance is simply frequency in hertz times 2 pi. Our signal, xt, is cosine of 2 pi F0 of t. So, F0 is a frequency in hertz. The samples xn are simply x at multiples of Ts. So that's cos of omega 0 n. Omega 0 is 2 pi. F0 over Fs, where Fs is simply 1 over the sampling period. Okay, we often go back between frequencies and sampling periods and hertzes and radians. So, you have to be used to jump back and forth with these notions. Now we are going to sample the sinusoid. When the sampling frequency Fs is bigger than 2F0, so F0 is the maximum frequency, we're on a sinusoid, so that's a good case when we sample twice above the Nyquist frequency. Then the digital frequency omega naught is between 0 and pi. Everything is okay. When Fs is exactly equal to 2F0, then omega naught is equal to pi. And the signal xn is simply minus 1 to the n. And so that's a maximal digital frequency that we're going to see. Then when Fs is between F0 and 2F0, so it is sub Nyquist sampling, then omega 0 is between pi and 2pi. And we actually see a negative frequency corresponding to pi over omega 0. Finally, when Fs is smaller than F0, which amounts to omega 0 being bigger than 2pi, then we have full aliasing. So the digital frequency is simply omega 0 mod 2pi, and this can be a much different frequency from the input frequency of the sinusoid, as we shall see. Let us see this sampling in action, namely on cosine 6 pi of t. So, F0 is 3Hz, the correct sampling frequency Fs has to be 6Hz or higher. So lets' start with Fs 100Hz, so that's highly oversampled, you can see the red dots. Are very close approximation to the continuous time function. Take Fs 50Hz. That's still much bigger than the, limit frequency 6Hz. So, still a very good approximation. Fs10Hz. This is still on the right side of the Nyquist sampling. And we still see the sinusoid, but it starts to be quite a sparse sampling of the sinusoid. F 6Hz is exactly the limit. So the samples alternate between plus 1 and minus 1, which is the maximum digital frequency. Fs 2.9Hz. Now we are actually below F0 and clearly writing into F aliasing. And we can see we have a few points here. But it doesn't really look like it's adequate representation of the sine wave. So we rescale, we take an interval of 2, instead of the interval of 1 from before. We still see that these points you know, do not give a good impression of the sine wave. So let's extend to an interval of 4, to an interval of 10. And now we see a sinusoid appearing. But this sinusoid actually has a frequency of 0.1Hz, as you can see. It has a full cycle here between 0 and 10, and because of aliasing, so the resulting frequency is actually 2.9Hz modulo 3Hz. And that is minus 0.1Hz, or because it is symmetric it is equal to a frequency of 0.1Hz. So it's a totally aliased version of the initial cosine function that we had, and we see another cosine which happens to be of 0.1Hz rather than of 3Hz. So that's the phenomenon of aliasing, very nicely graphically shown here.