Sie sind auf Seite 1von 43

# Sampling

Outline
 FT of comb function
 Sampling
• Nyquist Condition
 sinc interpolation
• Truncation
• Aliasing

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling

As we saw with the CCD camera and the pinhole imager, the detector plane is not a
continuous mapping, but a discrete set of sampled points. This of course limits the
resolution that can be observed.

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Limits of Sampling

## • Finite # of data points

• Finite field of view
• High spatial frequency features can be missed or recorded
incorrectly

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Formalism of Sampling

⎛ 2x ⎞ ∞
⎛x⎞
{fn}= ∫ TopHat⎜ ⎟Comb
⎜ ⎟ f (x)dx
−∞ ⎝ fov⎠ ⎝Δx⎠
recall that ∞
Combx
( )= ∑ δ(x−n) dx
n=−∞

1; x≤1
TopHatx
( ) ={0; x>1
22.058 - lecture 5, Sampling and the Nyquist Condition
Formalism of Sampling

⎛ 2x ⎞ ∞
{fn}= ∫ TopHat⎜ ⎟ ∑ δ(x−nΔx) f (x)dx
−∞ ⎝ fov⎠n=−∞
+fov
∞ 2
= ∑ ∫ f (x)δ(x−nΔx)
n=−∞−fov
2
+fov
2
fn = ∫ f (x)δ(x−nΔx)dx
−fov
2
22.058 - lecture 5, Sampling and the Nyquist Condition
Formalism of Sampling

f(x)

Comb(x/x)

TopHat(2x/fov)

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Formalism of Sampling

f(x)

Comb(x/x)

TopHat(2x/fov)

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Formalism of Sampling

{fn}

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Frequency of Sampling
data =Table @If @Mod@x, 7D<2, 1, - 1D * Exp@- Hx - 128L^2 ê 1000D, 8x, 1, 256<D;

ListPlot @data , 8PlotJoined -> True , PlotRange -> All , Axes -> False , AspectRatio -> 1 ê 4,
PlotStyle -> Thickness @0.005 D<D

FT
k

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Frequency of Sampling

every point

x
FT

k

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Frequency of Sampling

every point

x
FT

k

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Frequency of Sampling

every point

x
FT

k

Sampling
1

0.5

2 3 4 5 6

-0.5

-1

## In[19]:= p2=Plot @Cos@2 Pi 0.2 Hx - 1LD, 8x, 1, 6<,

8PlotPoints -> 512,
PlotStyle -> 8Thickness @0.01 D, RGBColor@1, 0, 0D<<D

## In[11]:= p4 =ListPlot @Table @Cos@2 Pi 1.2 xD, 8x, 0, 5, 1<D,

Prolog -> AbsolutePointSize @10DD

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling

1 1

0.5 0.5

2 3 4 5 6 2 3 4 5 6

-0.5 -0.5

-1 -1

## In[19]:= p2 =Plot @Cos@2 Pi 0.2 Hx - 1LD, 8x, 1, 6<,

8PlotPoints -> 512,
PlotStyle -> 8Thickness @0.01 D, RGBColor@1, 0, 0D<<D

## In[11]:= p4 =ListPlot @Table @Cos@2 Pi 1.2 xD, 8x, 0, 5, 1<D,

Prolog -> AbsolutePointSize @10DD

## In[18]:= p1 =Plot @Cos@2 Pi 1.2 Hx - 1LD, 8x, 1, 6<,

8PlotPoints -> 512,
PlotStyle -> 8Thickness @0.01 D, RGBColor@0, 0, 1D<<D

Sampling

1
1

0.5
0.5

2 3 4 5 6
2 3 4 5 6

-0.5
-0.5

-1
-1

## In[19]:= p2 =Plot @Cos@2 Pi 0.2 Hx - 1LD, 8x, 1, 6<,

8PlotPoints -> 512,
PlotStyle -> 8Thickness @0.01 D, RGBColor@1, 0, 0D<<D

## In[11]:= p4 =ListPlot @Table @Cos@2 Pi 1.2 xD, 8x, 0, 5, 1<D,

Prolog -> AbsolutePointSize @10DD

## In[20]:= p3 =Plot @Cos@2 Pi 2.2 Hx - 1LD, 8x, 1, 6<,

8PlotPoints -> 512,
PlotStyle -> 8Thickness @0.01 D, RGBColor@0, 1, 0D<<D

Sampling

1
1

0.5
0.5

2 3 4 5 6
2 3 4 5 6

-0.5
-0.5

-1
-1

## Nyquist theorem: to correctly identify a frequency

you must sample twice a period.

## So, if x is the sampling, then π/x is the maximum

spatial frequency.

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling A Simple Cosine Function

## Consider a simple cosine function,

s1 (t ) = cos(2πf o t )

## We know the Fourier Transform of this

€ (2πf o t ) ⇔ π (δ ( f − f o ) + δ ( f + f o ))
cos
⎛1⎞
What happens when we sample this at a rate of ⎜ ⎟
⎝Δt⎠
€ 1
where has the units of Hz
Δt
and Δt = the dwell of the sampled signal.

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling A Simple Cosine Function (cont …)

So that,

## s1 (n) = cos(2πf o nΔt )

= s1 ( t )∑ δ ( t − nΔt )
F {s1 (n)} = F {s1 ( t )∑ δ ( t − nΔt )}
= F {s1 ( t )} ⊗ F {∑ δ ( t − nΔt )}
⎡2π ⎛ 2πn ⎞⎤
= π [δ ( f − f o ) + δ ( f + f o )] ⊗ ⎢ ∑ δ ⎜⎝ f − ⎟⎠⎥
⎣ Δt Δt ⎦

Note, I’ve taken a short cut and left off the integrals that

are needed to sample with the delta function.

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Define A New Frequency: Case 1

## Define a new frequency 2π

fs = ; "the sampling frequency"
Δt
Case 1:
fs
fo < = f n = Nyquist frequency
2
€ 2f0

-fs 0 fs
In this case, there is no overlap and regardless of the complexity of this
spectrum (think of having a number or continuum of cosine functions),
the frequency spectrum correctly portrays the time evolution of the
signal.

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Case 2
f o > f s 2 = f n = Nyquist frequency
2f0

-fs 0 fs
Now the frequency spectrum overlaps and look what happens to our picture,
2f’0 f'0 = fs −f0

-fs 0 fs
So it appears as though we are looking at a frequency of

## f s − f o < f o - this is an aliased signal.

22.058 - lecture 5, Sampling and the Nyquist Condition
Nyquist Theorem

Consider what happens when there is a complex spectrum. Then the entire
spectrum overlaps. Either way, the frequency spectrum does not
correspond to a correct picture of the dynamics of the original time
domain signal.

## Nyquist Theorem: In order to correctly determine the frequency spectrum

of a signal, the signal must be measured at least twice per period.

## 22.058 - lecture 5, Sampling and the Nyquist Condition

cos(2πf o nΔt ) ; Δt = 1 f
s

So ⎛2πf o n ⎞
cos⎜ ⎟
€ ⎝ fs ⎠

Now let
fo > fs ∴ fo = fs − ( fs − fo )
€ 14 2 43
Δf

22.058 - lecture 5, Sampling and the Nyquist Condition
(cont…)
⎛2πn ⎞
cos⎜ [ f s − Δf ]⎟ or use :
⎝ fs ⎠
cos( A + B) =
⎛ 2πn ⎞
cos⎜2πn − Δf ⎟ cos( A) cos( B) − sin ( A) sin ( B)
⎝ fs ⎠
A = 2πn ∴ cos( A) = 1;sin ( A) = 0
⎛ Δf ⎞
cos⎜−2πn ⎟
⎝ fs ⎠
⎛2πnΔf ⎞

cos⎜ ⎟
€ ⎝ fs ⎠
Therefore we can see that it is not the Fourier Transform that fails to
correctly portray the signal, but by our own sampling process we mis-
represented the signal.

22.058 - lecture 5, Sampling and the Nyquist Condition
A Fourier Picture of Sampling

⎛ 2x ⎞ ∞

{fn}= ∫ TopHat⎜ ⎟ ∑ δ(x−nΔx)1 4 2f (4
x)dx
⎝ fov⎠ 3
−∞1 44 2 4 43 n=
1 −∞
44 2 4 43 c
c c
⎛ n2π ⎞ ∞
( ) ⊗ 2πΔx ∑ δ⎜k−
Sinckfov ⎟⊗ F(k)
⎝ Δx ⎠
1 4 4n=
4−∞
4 4 2 4 4 4 4 43
Look at this first

## 22.058 - lecture 5, Sampling and the Nyquist Condition

A Fourier Picture of Sampling

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Bandwidth Limited

time domain

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Limitations of Sampling

{fn}

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Limitations of Sampling

perfect sampling

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Limitations of Sampling

perfect sampling

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Limitations of Sampling

perfect sampling

Reciprocal Space

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling

60

50

40

30

20

10

0
0 10 20 30 40 50 60

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling

120

100

80

60

40

20

0
0 20 40 60 80 100 120

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Sinc interpolation

Filtering

## We can change the information content in the image by

manipulating the information in reciprocal space.

Filtering

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Fourier Convolution

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Deconvolution

I ( x ) = O( x) ⊗ PSF ( x) + N ( x )
{
noise

## Recall in an ideal world

i( k ) = O(k) − PSF(k)

## ∴ Try deconvolution with 1 PSF(k)

1
i perfect ( k ) = [O( k ) • PSF(k)
€ ]•
PSF (k )
an "inverse" filter
I perfect ( x) = [O( x) ⊗ PSF ( x) + N ( x)] ⊗ PSF −1 ( x)
14 2 43
means "inverse"
not 1
PSF ( x )

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Deconvolution (cont…)
This appears to be a well-balanced function, but look what happens in a
Fourier space however:
1 n(k)
i( k ) = O(k) • PSF(k) • +
PSF(k) PSF(k)
Recall that the Fourier Transform is linear where PSF(k) << n(k), then
noise is blown up. The inverse filter is ill-conditioned and greatly
increases the
€ noise particularly the high-frequency noise since
PSF (k ) ⇒ 0 at high k
1 4 4 4 4 2 4 4 4 43
normally
This is avoided by employing a “Wiener” filter.
PSF * ( k )
PSF
€w (k ) = 2
where * is the complex conjugate
PSF ( k ) + WN ( k )

## noise power spectral density −2

−2
(S N)
= (S k
N ( ))

22.058 - lecture 5, Sampling and the Nyquist Condition
Original Nyquist Problem
A black & white TV has 500 lines with 650 elements per line. These are
scanned through

Electron beam

Deflection magnets

Electron beam is scanned over the screen by deflection magnets and the
intensity of the beam is modulated to give the intensity at each point. The
refresh rate is 30 frames/second.
By the sampling theorem, if the frequency is f o , independent information
1
is available once every 2 f seconds.

## frames lines pixels

Need 30 × 500 × 650 = 9.75 ×10 6 impulse sec
€ sec frame line
information ∴ f ≥ 4.875 MHz

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Fourier Transform of a Comb Function

Comb( x ) = ∑ δ ( x − nX )
−∞

where
⎧1, x = nX ⎫
δ ( x − nX ) = ⎨ ⎬
⎩0, x ≠ nX ⎭

## The Fourier Transform we wish to evaluate is,

€ ∞
F {Comb(t )} = ∫ Comb( x )e−ikx dx
−∞

## One trick to this is to express the comb function as a Fourier series

expansion,€not the transform.

i2πnx
Comb( x) = ∑ a e n
X

n=−∞

where
x
1 2 −i2πnx
a n = ∫ Comb( x )e X
dx
Normalization to keep
X −x 2
the series unitary Limits chosen since this
is a periodic function

## 22.058 - lecture 5, Sampling and€the Nyquist Condition

Fourier Transform of a Comb Function
Over the interval −x 2 to x the comb function contains only a single
2
delta function. x
1 2 − i2πnx
a n = ∫ δ ( x)e X
dx
€ € X −x 2
1 4 4 2 4 43
select the x= 0 po int,
note this is only true
of a Dirac delta function.

1
an =
X
∴ A series representation of the comb function is

1 ∞ i 2 πnx
Comb( x) = ∑ e X

€ X n=−∞

## 22.058 - lecture 5, Sampling and the Nyquist Condition

Fourier Transform of a Comb Function

Now,

1 ∞ i 2 πnx
F{Comb} = ∫ ∑ e e dx X − ikx

−∞ X n=−∞

1 ∞ ∞
⎛ 2 πn ⎞
− ix ⎜ k− ⎟
= ∑∫e dx ⎝ X ⎠

X 1 4 2 43
n=−∞−∞

⎛ 2 πn ⎞
2 πδ ⎜ k− ⎟
⎝ X ⎠

2π ⎛ 2πn ⎞

∑ δ ( x − nX ) ⇔ ∑ δ ⎜k − ⎟
−∞ X ⎝
−∞ X ⎠

X 2π X
…1 € … X
0 x 0 k
€ €
Note:€Scaling laws hold