The sampling theorem is the most important idea in digital signal processing. It is the reason we can use digital computers to analyze and manipulate continuous time signals.
The sampling theorem consists of two separate ideas: The first is aliasing, the concept that different continous time signals can result in the same discrete time signal. The second idea is reconstruction, that if the sampling rate is sufficiently high, the continuous signal can be reconstructed exactly (or at least with high accuracy) from the discrete time signals.
This posting is about aliasing. We will look at reconstruction in a later posting.
%pylab inline
A simple example of two sinusoids aliasing to the same digital signal.
T=1 #sampling period
t = linspace(0,8,801) #for the continuous time signals
n = arange(0,9) #discrete time
f1 = 0.3
f2 = 1.3
w1 = 2*pi*f1
w2 = 2*pi*f2
y1 = cos(w1*t)
y2 = cos(w2*t)
plot(t,y1, t,y2)
scatter(n,cos(2*pi*f1*n),marker='x')
scatter(n,cos(2*pi*f2*n),marker='4')
The two scatter plots are on top of each other, showing that sampling the two continuous time sinusoids results in the same discrete time signal.
A positive frequency can alias to a negative frequency and result in the same samples.
f3 = 0.6
f4 = -0.4
w3 = 2*pi*f3
w4 = 2*pi*f4
y3 = cos(w3*t)
y4 = cos(w4*t)
plot(t,y3,t,y4)
scatter(n, cos(2*pi*f3*n))
Notice the samples are at the intersections of both sinusoids.
To get the same samples, we have to assure the frequencies and phases match. Here's an example with the same digital frequencies, but the samples differ because the phase isn't right.
f3 = 0.6
f4 = -0.4
w3 = 2*pi*f3
w4 = 2*pi*f4
y3 = cos(w3*t)
y4 = sin(w4*t)
plot(t,y3,t,y4)
scatter(n, cos(w3*n),marker='x')
scatter(n, sin(w4*n))
Here we plot two sinusoids at the same frequency, w3, but at different phases and the two sets of samples. Note the samples intersect the sinusiods even though the original sinusoids were at two different frequencies, f3 and f4. This shows that the digital frequencies are the same even though the phases differ.
plot(t,cos(w3*t),t,sin(w3*t))
scatter(n, cos(w3*n),marker='x')
scatter(n, sin(w4*n))
Charles Boncelet, 17 August 2014