43
22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline FT of comb function Sampling • Nyquist Condition sinc interpolation • Truncation • Aliasing

22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline FT of comb function Sampling Nyquist Condition sinc interpolation Truncation

  • View
    221

  • Download
    1

Embed Size (px)

Citation preview

Page 1: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling

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

Page 2: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

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.

Page 3: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

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

Page 4: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Formalism of Sampling

fn{ }= TopHat2xfov

⎝ ⎜

⎠ ⎟

−∞

∞∫ Comb

xΔx

⎛ ⎝ ⎜

⎞ ⎠ ⎟ f x( )dx

recall that

Page 5: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Formalism of Sampling

fn{ }= TopHat2xfov

⎝ ⎜

⎠ ⎟ δ x−nΔx( ) f x( )dxn=−∞

∞∑

−∞

∞∫

= f x( )δ x−nΔx( )−fov

2

+fov2∫

n=−∞

∞∑

fn= f x( )δ x−nΔx( )dx−fov

2

+fov2∫

Page 6: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Formalism of Sampling

f(x)

Comb(x/x)

TopHat(2x/fov)

Page 7: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Formalism of Sampling

f(x)

Comb(x/x)

TopHat(2x/fov)

Page 8: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Formalism of Sampling

{fn}

Page 9: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

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.005D<D

FT

x

k

Page 10: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Frequency of Sampling

FT

x

k

every point

every second point

Page 11: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Frequency of Sampling

FT

x

k

every point

every third point

Page 12: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Frequency of Sampling

FT

x

k

every point

every fourth point

Page 13: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling

In[19]:= p2 =Plot @Cos@2Pi 0.2 Hx - 1LD, 8x, 1, 6<,8PlotPoints -> 512,PlotStyle -> 8Thickness @0.01D, RGBColor@1, 0, 0D<<D

In[11]:= p4 =ListPlot @Table @Cos@2Pi 1.2 xD, 8x, 0, 5, 1<D,Prolog -> AbsolutePointSize @10DD

2 3 4 5 6

-1

-0.5

0.5

1

Page 14: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling

In[19]:= p2 =Plot @Cos@2Pi 0.2 Hx - 1LD, 8x, 1, 6<,8PlotPoints -> 512,PlotStyle -> 8Thickness @0.01D, RGBColor@1, 0, 0D<<D

In[11]:= p4 =ListPlot @Table @Cos@2Pi 1.2 xD, 8x, 0, 5, 1<D,Prolog -> AbsolutePointSize @10DD

2 3 4 5 6

-1

-0.5

0.5

1

In[18]:= p1 =Plot @Cos@2Pi 1.2 Hx - 1LD, 8x, 1, 6<,8PlotPoints -> 512,PlotStyle -> 8Thickness @0.01D, RGBColor@0, 0, 1D<<D

2 3 4 5 6

-1

-0.5

0.5

1

Page 15: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling

In[19]:= p2 =Plot @Cos@2Pi 0.2 Hx - 1LD, 8x, 1, 6<,8PlotPoints -> 512,PlotStyle -> 8Thickness @0.01D, RGBColor@1, 0, 0D<<D

In[11]:= p4 =ListPlot @Table @Cos@2Pi 1.2 xD, 8x, 0, 5, 1<D,Prolog -> AbsolutePointSize @10DD

In[20]:= p3 =Plot @Cos@2Pi 2.2 Hx - 1LD, 8x, 1, 6<,8PlotPoints -> 512,PlotStyle -> 8Thickness @0.01D, RGBColor@0, 1, 0D<<D

2 3 4 5 6

-1

-0.5

0.5

1

2 3 4 5 6

-1

-0.5

0.5

1

Page 16: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling

2 3 4 5 6

-1

-0.5

0.5

1

2 3 4 5 6

-1

-0.5

0.5

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.

Page 17: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling A Simple Cosine Function

Consider a simple cosine function,

s1 t( ) = cos 2πfot( )

We know the Fourier Transform of this

cos 2πfot( ) ⇔ π δ f − fo( ) + δ f + fo( )( )

What happens when we sample this at a rate of

1Δt

⎛ ⎝ ⎜

⎞ ⎠ ⎟

where 1

Δt has the units of Hz

and Δt = the dwell of the sampled signal.

Page 18: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling A Simple Cosine Function (cont …)

So that,

s1 n( ) = cos 2πfonΔt( )

= s1 t( ) δ t − nΔt( )∑F s1 n( ){ } = F s1 t( ) δ t − nΔt( )∑{ }

= F s1 t( ){ }⊗ F δ t − nΔt( )∑{ }

= π δ f − fo( ) + δ f + fo( )[ ]⊗2π

Δtδ f −

2πn

Δt

⎛ ⎝ ⎜

⎞ ⎠ ⎟∑

⎣ ⎢ ⎤

⎦ ⎥

Note, I’ve taken a short cut and left off the integrals that are needed to sample with the delta function.

Page 19: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Define A New Frequency: Case 1

Define a new frequency

fs =2π

Δt; "the sampling frequency"

Case 1:

fo < f s2 = fn = Nyquist frequency

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.

fs-fs

2f0

0

Page 20: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Case 2

fo > f s2 = fn = Nyquist frequency

Now the frequency spectrum overlaps and look what happens to our picture,

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

fs − fo < fo - this is an aliased signal.

fs-fs

2f0

0

2f’0

fs0-fs

f '0= fs−f0

Page 21: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

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.

Page 22: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Return to the sampled cosine function

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

cos2πfon

fs

⎝ ⎜

⎠ ⎟

So

Now let

fo > f s ∴ fo = f s − f s − fo( )

Δf1 2 4 3 4

Page 23: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

(cont…)

cos2πn

f sf s − Δf[ ]

⎝ ⎜

⎠ ⎟

cos 2πn −2πn

f sΔf

⎝ ⎜

⎠ ⎟

cos −2πnΔf

f s

⎝ ⎜

⎠ ⎟

cos2πnΔf

f s

⎝ ⎜

⎠ ⎟

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.

or use :

cos A + B( ) =

cos A( )cos B( ) − sin A( )sin B( )

A = 2πn ∴ cos A( ) =1;sin A( ) = 0

Page 24: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

A Fourier Picture of Sampling

fn{ }= TopHat2xfov

⎝ ⎜

⎠ ⎟

c1 2 4 4 3 4 4

δ x−nΔx( )n=−∞

∞∑

c1 2 4 4 3 4 4

f x( )dx

c1 2 4 3 4

−∞

∞∫

Sinckfov( )⊗2πΔx δ k−n2πΔx

⎛ ⎝ ⎜

⎞ ⎠ ⎟

n=−∞

∞∑ ⊗F(k)

Look at this first1 2 4 4 4 4 4 3 4 4 4 4 4

Page 25: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

A Fourier Picture of Sampling

Page 26: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Bandwidth Limited

time domain

Page 27: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Limitations of Sampling

{fn}

Page 28: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Limitations of Sampling

perfect sampling

average 3 data points

Page 29: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Limitations of Sampling

perfect sampling

average 5 data points

Page 30: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Limitations of Sampling

perfect sampling

average 7 data points

Page 31: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Reciprocal Space

real space reciprocal space

Page 32: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling

real space under sampled

0 10 20 30 40 50 600

10

20

30

40

50

60

Page 33: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling

real space zero filled0 20 40 60 80 100 120

0

20

40

60

80

100

120

Page 34: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Sinc interpolation

Page 35: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Filtering

We can change the information content in the image by manipulating the information in reciprocal space.

Weighting function in k-space.

Page 36: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Filtering

We can also emphasis the high frequency components.

Weighting function in k-space.

Page 37: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Fourier Convolution

Page 38: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

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

1PSF(k)

iperfect k( ) = O k( ) • PSF(k)[ ] •1

PSF k( )

an "inverse" filter

I perfect x( ) = O x( )⊗ PSF x( ) + N x( )[ ]⊗ PSF −1 x( )means "inverse" not 1

PSF x( )

1 2 4 3 4

Page 39: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

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:

i k( ) =O(k) • PSF(k) •1

PSF(k)+

n(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

normally1 2 4 4 4 4 3 4 4 4 4

This is avoided by employing a “Wiener” filter.

PSFw k( ) =PSF * k( )

PSF k( )2

+WN k( ) where * is the complex conjugate

SN( )

−2

noise power spectral density

= SN k( )( )

−2

Page 40: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

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 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 , independent information is available once every seconds.

fo

1

2 f

30frames

sec×500

lines

frame×650

pixels

line= 9.75 ×106 impulse

sec

∴ f ≥ 4.875 MHz

Deflection magnets

Electron beam

Need information

Page 41: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Fourier Transform of a Comb Function

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

where

δ x − nX( ) =1, x = nX

0, x ≠ nX

⎧ ⎨ ⎩

⎫ ⎬ ⎭

The Fourier Transform we wish to evaluate is,

F Comb t( ){ } = Comb x( )e−ikxdx−∞

One trick to this is to express the comb function as a Fourier series expansion, not the transform.

Comb x( ) = anei2πnx

X

n=−∞

where

an =1

XComb x( )e

−i2πnxX dx

−x2

x2

∫Normalization to keep the series unitary Limits chosen since this

is a periodic function

Page 42: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Fourier Transform of a Comb Function

Over the interval to the comb function contains only a single delta function.

−x2

x2

an =1

Xδ x( )e

− i2πnxX dx

−x2

x2

select the x= 0 po int,note this is only trueof a Dirac delta function.

1 2 4 4 3 4 4

an =1

X

∴ A series representation of the comb function is

Comb x( ) =1X

ei 2πnx

X

n=−∞

Page 43: 22.058 - lecture 5, Sampling and the Nyquist Condition Sampling Outline  FT of comb function  Sampling Nyquist Condition  sinc interpolation Truncation

22.058 - lecture 5, Sampling and the Nyquist Condition

Fourier Transform of a Comb Function

Now,

F Comb{ } =1X

ei 2πnx

Xe− ikxdxn=−∞

∑−∞

=1X

e− ix k−

2πn

X

⎛ ⎝ ⎜

⎞ ⎠ ⎟

dx−∞

2πδ k−2πn

X

⎛ ⎝ ⎜

⎞ ⎠ ⎟

1 2 4 3 4 n=−∞

δ x− nX( )−∞

∑ ⇔2πX

δ k −2πnX

⎛ ⎝ ⎜

⎞ ⎠ ⎟

−∞

0 0 kx

…1 …

2πX

2πX

X

Note: Scaling laws hold