The Nyquist Sampling Theorem

In this note we examine an important limitation you will encounter when sampling continuous signals.  Sampled signals happen in many environments, including those below.

• If you measure data in the lab and store it in a file - to be analyzed later in Mathcad, Matlab or Excel, for example - you store samples of a signal (as well as the times at which the data was sampled).
• If you use a telephone, many calls (all long distance calls) sample your voice signal, then transmit digital information, and reconstitute an analog signal (one someone can hear) on the far end of the connection.
If you measure lab data, and analyze it, you will probably plot the data so that you can see what it looks like.  If you talk on the phone, you want to be able to generate an accurate copy of the original signal on the far end of the connection.  In both cases there are two important things that happen.
• The original signal is sampled at discrete instants - and they are usually sampled at uniformly spaced intervals.
• The sampled version is eventually used to generate a copy of the original signal.
The problem that can arise is that the sampling rate determines how well you can reconstitute the signal - to plot a graph, or to acccurately copy a voice signal.  We need to think about a few ideas first.
• The signal we are sampling has a frequency spectrum.  Let us assume that the highest frequency component in the signal is fmax.
• If you are familiar with Fourier Transforms, you may realize that frequency spectra of realistic signals are not zero above some arbitray frequency.  A real signal will have a spectrum that gets smaller and smaller at higher and higher frequencies, but which only approach zero asymptotically.  We are really assuming that our signal has negligible components above fmax.
• To reproduce a signal with a highest frequency component, fmax, the sampling frequency (the frequency at which samples are taken) must be at least twice the highest frequency component.  In other words, the signal cannot be reproduced accurately unless the sampling frequency is at least 2fmax - a frequency that is referred to as the Nyquist frequency for the signal.  If the sampling frequency is lower than the Nyquist frequency, that is referred to as undersampling.
It is important to get a sense of what this means and what can happen.  We have a simulator you can use to demonstrate some of the pitfalls of undersampling and what can happen when that occurs.  Click here to get the simulator in a separate window.

Once you have the simulator running, click the Start button and examine the output.  Then answer this question.

Question

Q1    Does it look to be possible to reconstruct the original sine wave from the sampled values (large points)?

We want you to do a few numerical experiments using the simulator.

Experiment 1

Change the frequency to 2 Hz.  Observe what happens.  Would you be able to reconstruct the signal from the samples?

Now, let us set some conditions.
• Set the sampling period to 0.5 seconds.
Before you continue, answer the following question.
Question

Q2    When the sampling period is 0.5 seconds, what is the Nyquist Frequency - i.e. the frequency limit for the largest frequency in the signal?

When you are done, you realize that the highest frequency that you can sample is 1.0 Hz.  OK, so let's set the frequency to be right at the limit.
Experiment 2

When the signal frequency is 1.0 Hz and you sample right at the Nyquist rate, can you reconstruct the signal?

OK, now, theoretically, if you sample below the Nyquist rate you should get samples from which you can reconstruct the signal.
Experiment 3

Change the frequency to 0.9 Hz.  Observe what happens.  Would you be able to reconstruct the signal from the samples?

Now, for the curious among you, let us see what would happen if you had a signal just over the Nyquist limit.

Experiment 4

Change the frequency to 1.1 Hz.  Observe what happens.  Would you be able to reconstruct the signal from the samples?

Maybe you need to be even more curious.  To help you along, try this.

Experiment 5

Change the frequency to 2.1 Hz.  Observe what happens.  Would you be able to reconstruct the signal from the samples?

Experiment 5 is a real puzzler.  It certainly seems like you can reconstruct a sine wave from the samples, but the obvious signal that you would reconstruct is not the signal you want - the original signal.  It is at a frequency that is not correct.  Actually, you get samples that are consistent with a lower frequency sine wave, and if you had that data in a file (just the sampled points, the large dots) you would have no way of knowing that the signal had not been sampled correctly (i.e. that whoever generated the data had undersampled.) and you would be justified in thinking that the apparent low frequency sine wave (see the large dots) was the actual signal recorded.

The consequences of undersampling are that a frequency higher than the Nyquist limit is aliased into another signal with a frequency within the Nyquist limit.  Aliasing causes errors in computation of the magnitude of frequency components at frequencies far from the signal that causes the problem.

The conclusion you should get from this is that is is very possible to get spurious information into a data file if you have not sampled fast enough, and you should be aware of the possibility of that kind of error.