Demonstration 2: Sampling, Aliasing, and Frequency Response, Part 2

Flash and JavaScript are required for this feature.

Download the video from iTunes U or the Internet Archive.

Topics covered: Sampling and aliasing with a sinusoidal signal, sinusoidal response of a digital filter, dependence of frequency response on sampling period, periodic nature of the frequency response of a digital filter.

Instructor: Prof. Alan V. Oppenheim

The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To make a donation or view additional materials from hundreds of MIT courses, visit MIT OpenCourseWare at ocw.mit.edu.

[MUSIC PLAYING]

ALAN OPPENHEIM: Here we demonstrate the effects of sampling and aliasing by using this non-recursive digital filter. Where as a digital filter, it's simply set up as an identity system. But we take advantage of the fact that it has a sampler for the input and a de-sampler for the output.

To demonstrate the sampling and aliasing effect, we'll use a sinusoidal input. And so on the oscilloscope, what we have are two traces. The top trace is the input sinusoid. And the bottom trace is the output sinusoid.

And we know that we expect that as the input sinusoidal frequency is increased, the output sinusoidal frequency will likewise increase until we get into the vicinity of half the sampling frequency. In the vicinity of half the sampling frequency, because of the fact that the low pass filter is not an ideal low pass filter, we have a beating effect. And we see the beating effect evident here.

Now if we were to increase the input frequency past the half the sampling frequency, even though the input frequency would increase, the output frequency would decrease due to aliasing. And let's illustrate that by first moving back down toward DC. And then using an automatic sweep, to sweep us from DC through half the sampling frequency up to the sampling frequency.

And so here we get in the vicinity of half the sampling frequency. We see the beating effect. Past that, the output frequency decreases, even though the input frequency is increasing.

And now, let's illustrate that once more. But in this case, let's listen to the output as well as watching the output.

[HIGH PITCH FREQUENCY]

We hear it increase. And then we hear the output frequency decrease.

[FREQUENCY STOPS]

What we see here is the impulse response of the overall system. And we observe, for one thing, that it's a symmetrical impulse response. In other words, corresponds to a linear phase filter.

We can also look at the impulse response before the de-sampling low pass filter. Lets take out the de-sampling low pass filter slowly. And what we observe is basically the output of the digital to analog converter. Which of course, is a staircase or boxcar function, not an impulse train.

In the real world, the output of a D to A converter generally is a boxcar type of function. We can put the de-sampling filter back in now. And notice that the effect of the de-sampling filter is basically to smooth out the rough edges in the boxcar output from D to A converter.

Now what we'd like to illustrate is the frequency response of the equivalent continuous time filter. And we can do that by sweeping the filter with a sinusoidal input. So what we'll see in this demonstration is on the upper trace, the input sinusoid, on the lower trace, the output sinusoid. Using a 20 kilohertz sampling rate and a sweep from 0 to 10 kilohertz, in other words, a sweep from 0 to effectively pi in terms of the digital filter.

So what we'll observe as the input frequency increases is that the output sinusoid will have essentially constant amplitude up to the cutoff frequency of the filter, and then approximately zero amplitude past. So let's now sweep the filter frequency response. And there is the filter cutoff frequency.

Now we can also observe the filter frequency responds in several other ways. One way in which we can observe it is by looking also at the amplitude of the output sinusoid as a function of frequency rather than as a function of time. And so we'll observe that on the left hand scope.

While on the right hand scope, we'll have the same trace that we just saw, namely two traces. The upper trace is the input sinusoid. The lower trace is the output sinusoid.

And in addition to observing the frequency response, let's also listen to the output sinusoid and observe the attenuation in the output as we go from the filter passband to the filter stopband. Again, a 20 kilohertz sampling rate. And a sweep range from 0 to 10 kilohertz.

[HIGH PITCH FREQUENCY]

Now of course, we're in the filter stopband.

Now if we increase the sweep range from 10 kilohertz to 20 kilohertz so that the sweep range is equal to the sampling frequency, in essence that corresponds to sweeping out the digital filter from 0 to 2 pi. And in that case, we'll begin to see some of the periodicity in the digital filter frequency response. So let's do that now with a 20 kilohertz sampling rate and a sweep range of 0 to 20 kilohertz.

[HIGH PITCH FREQUENCY]

And now we come near 2 pi we get back into the passband. And finally back to a 0 to 10 kilohertz sweep, so that we're again sweeping only from 0 to pi with regard to the digital filter.

[HIGH PITCH FREQUENCY]

OK, now what we would like to demonstrate is the effect of changing the sampling frequency. And we know that the effective filter cutoff frequency is tied to the sampling frequency. And for this particular filter, corresponds to a tenth of the sampling frequency.

Consequently, if we double the sampling frequency, we should double the effective filter passband width or double the filter cutoff frequency. And so let's do that now. Again, a 0 to 10 kilohertz sweep range, but a 40 kilohertz sampling frequency.

[HIGH PITCH FREQUENCY]

And we should observe that the filter cutoff frequency has now doubled to 4 kilohertz.

Now let's begin to decrease the filter sampling frequency. So from 40, let's change the sampling frequency to 20 kilohertz. We should see the cutoff frequency cut in half.

[HIGH PITCH FREQUENCY]

Now we can go even further. We can cut the sampling frequency down to 10 kilohertz. And remember that the sweep range is zero to 10 kilohertz. So now we'll be sweeping from 0 to 2 pi.

[HIGH PITCH FREQUENCY]

So as we get close to 2 pi we'll see the passband again.

And now let's cut down the sampling frequency even further to 5 kilohertz.

[SHORT HIGH PITCH FREQUENCY]

Here we are at 2 pi.

[HIGH PITCH FREQUENCY]

And then at 4 pi.

All right, so that illustrates the effect of changing the sampling frequency. Now let's conclude this demonstration of the effect of the sampling frequency on the filter cutoff frequency by carrying out some filtering on some live audio.

What we'll watch, in this case, is the output audio waveform as a function of time on the single trace scope. And also, we'll listen to the output. We'll begin it with a 40 kilohertz sampling rate, then reduce that to 20 kilohertz, 10 kilohertz, and then 5 kilohertz. And in each of those cases, the effective filter cutoff frequency then is cut in half from 4 kilohertz to 2 kilohertz to 1 kilohertz and then to 500 cycles.

So let's begin with a 40 kilohertz sampling frequency, or an effective filter cutoff frequency of 4 kilohertz.

[MUSIC - SCOTT JOPLIN, "MAPLE LEAF RAG"]

Now let's reduce that to 20 kilohertz sampling frequency or a 2 kilohertz filter. Then a 10 kilohertz sampling frequency. And finally, a 5 kilohertz sampling frequency corresponding to a 500 cycle equivalent analog filter.

All right, now let's finally conclude by returning to a little higher quality ragtime by changing the sampling frequency back to 40 kilohertz.