When we convert a continuous, analog signal to a digital signal (digitize it), we sample its value at regular intervals. The sequence of numbers that results represents the original signal at these sample points, but ignores what goes on between them. If the signal is sufficiently well-behaved (i.e. it satisfies the Nyquist criterion and contains no energy at frequencies greater than half the sampling frequency), then these sample points are enough to represent the original signal exactly. But if the original signal contains a frequency greater than half the sampling rate, that frequency will be aliased to a lower frequency.
Let's start by looking at what sampling looks like in the time domain.
| ||
Step 1: |
Connect
the function generator output
and
CH1
of the scope to
A/D input4 (pin 46 on the interface board socket strip).
| |
Step 2: |
Set the function generator to produce a 5 V p-p, 300 Hz
sine wave.
| |
Step 3: |
Load the "wave display 1" Labview program.
Note the sampling rate.
Start the program by pressing the
run button
or by pressing CTRL-R with the cursor over the window.
Here's what we have: | |
Step 4: |
You should see about three cycles of a sine wave
displayed in the waveform graph.
Unlike last week's display, the samples are shown as individual
dots, rather than connected line segments.
As we increase the frequency of the sine wave, we get fewer
samples of each cycle and the picture becomes less clear.
| |
Step 5: |
Increase the frequency to about 2 kHz.
Freeze the display by pressing the
STOP
button.
You should see either
several lines or
several overlapping sine waves.
This is an illusion caused by the fact that only a few samples
of each cycle are being taken.
| |
Question 1: |
Make a sketch to illustrate what happens when the frequency
of the waveform is equal to (or nearly equal to) a small
submultiple (e.g. 1/4) of the sampling rate.
| |
Step 6: |
To see the actual underlying waveform more clearly, switch the
display to connected lines:
Place the cursor on the box marked "display style"
underneath the display and select the continuous line style
from the "Common Plots" submenu.
| |
Step 7: |
Restart the program and continue increasing the
frequency of the function generator until you reach
5 kHz, stopping at several points along the way
to examine the waveform.
When the function generator frequency is exactly half the sampling frequency the samples will alternate the same positive and negative values. (This may be easier to see by switching to the vertical line plot display style.)
Continue increasing the function generator frequency.
Notice that as you approach 10 kHz, you begin to see
a well defined sine wave which
decreases
in frequency as you increase the function generator frequency.
This is the
alias
of the generator frequency.
At exactly 10 kHz you should get a
zero frequency sine wave
(it may help to turn the
trigger
on the waveform display to
Off).
| |
Step 8: |
Continue increasing the function generator frequency past
10 kHz.
Note that you once again have a sine wave that increases
in frequency as the input frequency increases.
| |
Question 2: |
Derive an expression that relates the frequency of the
sine wave displayed by the waveform display program to the
actual frequency of the input sine wave.
| |
Step 9: |
Try square and triangle waves of various frequencies
and see what happens to them as the frequency changes.
| |
Step 10: |
Press the STOP button and exit the waveform view program. |
| ||
Step 1: |
Set the function generator to produce a 500 Hz, 5 V p-p
sine wave.
| |
Step 2: |
Load the "Spectrum Analyzer 5" program.
This is similar to the program we used last week, but has
a much lower sampling rate (10 kHz instead of 100 kHz).
It also has an additional feature we'll examine in a few minutes.
We have a new circuit without having to move any wires. Here it is: | |
Step 3: |
Start the spectrum analyzer program.
You should see a display similar to last week's,
but with a higher noise level and more extraneous frequencies.
| |
Step 4: |
Increase the frequency of the function generator.
Note that some of the extraneous frequencies move,
but not all in the same direction.
| |
Step 5: |
Continue to increase the frequency towards 5 kHz.
What happens when the frequency passes 5 kHz?
| |
Step 6: |
Continue increasing the frequency towards 10 kHz.
The behavior of the upper (waveform) display should be
similar to what you saw in Part 1.
| |
Step 7: |
Return the frequency to 500 Hz.
Slowly increase the frequency and watch the harmonics
(of the impure sine wave) as they approach the right hand
edge of the display.
(Note that this is 5000 Hz, which is half the sampling frequency.)
What happens to each harmonic as it reaches this frequency?
| |
Step 8: |
Try to follow one of the wayward harmonics after it is reflected
off the right hand edge of the display.
What happens to it when it reaches the left hand edge?
| |
Step 9: |
Switch the function generator to triangular wave.
Note the waveform and spectrum display.
Vary the frequency slightly and watch what happens to the
spectrum.
Do the same thing with a square wave.
| |
Question 3: |
Explain the spectrum displays you have seen for the
"sine", triangle, and square waves.
Sketch the spectrum you would expect from a theoretical
viewpoint for several "interesting" cases.
| |
Step 10: |
Switch the function generator back to sine wave and set the frequency to 500 Hz. |
| ||
Step 1: |
On the right hand side of the spectrum analyzer is a group
of controls which control the quantization of the sampled signal.
The
Max level
control sets the maximum allowed absolute value of the signal.
The
No of levels
control sets the number of different levels that may be
represented within the allowed range (i.e. between plus and minus
Max level).
| |
Step 2: |
With the quantization button
OFF,
set the
Number of levels
control to 100.
Turn quantization on by pressing the button.
Note the change in the spectrum.
Is there any visible change in the waveform display?
| |
Step 3: |
Reduce the number of levels to 10.
The effect on the waveform should now be visible.
What happens to the spectrum?
| |
Step 4: |
Try several different values for the number of quantization levels.
What is the relation between the number of levels and spectrum
of the resulting signal?
| |
Step 5: |
Stop and exit the spectrum analyzer program. |