Loading [MathJax]/jax/element/mml/optable/GeneralPunctuation.js

Sampling Exploration

I needed to review the Nyquist–Shannon sampling theorem. The coolest thing about Nyquist is that it expresses the sample-rate in terms of the function’s bandwidth and leads to a formula for the mathematically ideal interpolation algorithm.

What is sampling?

Sampling is nothing more than converting a signal into a numeric sequence. Shannon states:

If a function x(t) contains no frequencies higher than B hertz, it is completely determined by giving its ordinates at a series of points spaced 1/(2B) seconds apart.

This is really simple: A sufficient sample-rate is therefore  \scriptstyle 2B samples/second, or anything larger. The two thresholds, \scriptstyle 2B and \scriptstyle f_s/2 , are respectively called the Nyquist rate and Nyquist frequency.

I can’t understand something unless I explore with it. So, I defined the following code.

First we have to make the following definitions for a given sample-rate of  f_s :

  • \scriptstyle T \stackrel{\mathrm{def}}{=}\ 1/f_s represents the interval between samples.

Say we have a simple sign wave modulated at a frequency of 1/8.

Simple Sin Wave

If we explore, we can get:

Exploration

Aliasing

When the bandlimit is too high (or there is no bandlimit), the reconstruction exhibits imperfections known as aliasing.

Let X(f) be the Fourier transform of bandlimited function x(t):

X(f) \stackrel{\mathrm{def}}{=}\ \int_{-\infty}^{\infty} x(t) \ e^{- i 2 \pi f t} \ {\rm d}t

and

X(f) = 0 \quad \text{for all} |f| > B

The Poisson summation formula shows that the samples, x(nT), of function x(t) are sufficient to create a periodic summation of function X(f). The result is:

X_s(f)\ \stackrel{\mathrm{def}}{=} \sum_{k=-\infty}^{\infty} X\left(f – k f_s\right) = \sum_{n=-\infty}^{\infty} \underbrace{T\cdot x(nT)}_{x[n]}\ e^{-i 2\pi n T f},

This function is also known as the discrete-time Fourier transform.

Questions I’m after:

  • How is it that the samples of several different sine waves can be identical, when at least one of them is at a frequency above half the sample rate?

You can see my source code here:

close all;
clear all;
t=-10:0.01:10;
T=8;
fm=1/T;
x=cos(2*pi*fm*t);
fs1=1.2*fm;
fs2=2*fm;
fs3=8*fm;
n1=-4:1:4;
xn1=cos(2*pi*n1*fm/fs1);
subplot(221)
plot(t,x);
xlabel('time in seconds');
ylabel('x(t)');
title('continous time signal');
subplot(222)
stem(n1,xn1);
hold on;
plot(n1,xn1);
xlabel('n');
ylabel('x(n)');
title('discrete time signal with fs<2fm');
%
n2=-5:1:5;
xn2=cos(2*pi*n2*fm/fs2);
subplot(223)
stem(n2,xn2);
hold on;
plot(n2,xn2);
xlabel('n');
ylabel('x(n)');
title('discrete time signal with fs=2fm');
%
n3=-20:1:20;
xn3=cos(2*pi*n3*fm/fs3);
subplot(224)
stem(n3,xn3);
hold on;
plot(n3,xn3);
xlabel('n');
ylabel('x(n)');
title('discrete time signal with fs>2fm');

1 thought on “Sampling Exploration”

Leave a Comment