Sunteți pe pagina 1din 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

Comb(x) =

( x n)
n=

dx

1; x 1 TopHat (x ) = 0; x >1
22.058 - lecture 5, Sampling and the Nyquist Condition

Formalism of Sampling

2x { fn } = TopHat (x nx ) f (x)dx fov n=

n= fov
2

+ fov 2

f (x ) (x nx)

fn =

+ fov 2 fov 2

f (x )(x n x)dx

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 , 7 D < 2 , 1 , - 1 D * Exp @ - Hx - 128 L^ 2 1000 D, 8x , 1 , 256 <D; -> All , Axes -> False , AspectRatio -> 1 4 , ListPlot @ data , 8PlotJoined -> True , PlotRange PlotStyle -> Thickness @ 0.005 D<D

FT k
22.058 - lecture 5, Sampling and the Nyquist Condition

Frequency of Sampling every point x FT every second point k

22.058 - lecture 5, Sampling and the Nyquist Condition

Frequency of Sampling every point x FT every third point

22.058 - lecture 5, Sampling and the Nyquist Condition

Frequency of Sampling every point x FT every fourth point k

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling
1

0.5

2 -0.5

-1

In[19]:=

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

In[11]:=

p4 = ListPlot @ Table @ Cos @ 2 Pi 1.2 x D, 8x , 0 , 5 , 1 <D, Prolog -> AbsolutePointSize @ 10 DD

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling
1 1

0.5

0.5

2 -0.5

6 -0.5

-1

-1

In[19]:=

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

In[11]:=

p4 = ListPlot @ Table @ Cos @ 2 Pi 1.2 x D, 8x , 0 , 5 , 1 <D, Prolog -> AbsolutePointSize @ 10 DD

In[18]:=

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

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling
1 1

0.5

0.5

2 -0.5

6 -0.5

-1

-1

In[19]:=

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

In[11]:=

p4 = ListPlot @ Table @ Cos @ 2 Pi 1.2 x D, 8x , 0 , 5 , 1 <D, Prolog -> AbsolutePointSize @ 10 DD

In[20]:=

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

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling
1 1

0.5

0.5

2 -0.5

6 -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

cos(2 f o t ) ( ( f f o ) + ( f + f o ))
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 nt ) = s1 (t ) (t nt ) F {s1 (n)} = F {s1 (t ) (t nt )} = F {s1 (t )} F { (t nt )} 2 = [ ( f f o ) + ( f + f o )] t 2 n f t

Note, a short cut has been taken, 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 Case 1:

2 fs = ; " the sampling frequency" t

fo <

fs

= f n = Nyquist frequency
2f0

-fs

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

fo >

fs

= f n = Nyquist frequency 2f0

-fs

0 2f0

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

fs

f '0 = fs f 0

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

-fs

fs

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

Return to the sampled cosine function

cos(2 f o nt ) ; t = 1
So

fs

2 f o n cos fs

Now let

fo > fs fo = fs ( fs fo ) 1 4 2 4 3 f

22.058 - lecture 5, Sampling and the Nyquist Condition

(cont)
2 n cos [ f s f ] fs 2 n f cos2 n fs f cos2 n fs

or use : cos(A + B) = cos(A)cos(B) sin (A)sin (B) A = 2 n cos(A) = 1;sin (A) = 0

2 nf 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 misrepresented the signal.
22.058 - lecture 5, Sampling and the Nyquist Condition

A Fourier Picture of Sampling

2x f (x )dx { fn } = TopHat (x nx )14243 fov 14 = 4 244 3n 14 4 244 3 c c c

n2 Sinc(kfov ) 2 x k F (k ) x n= 244444 3 144444 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

average 3 data points

22.058 - lecture 5, Sampling and the Nyquist Condition

Limitations of Sampling

perfect sampling

average 5 data points

22.058 - lecture 5, Sampling and the Nyquist Condition

Limitations of Sampling

perfect sampling

average 7 data points

22.058 - lecture 5, Sampling and the Nyquist Condition

Reciprocal Space

real space

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

real space

under sampled

22.058 - lecture 5, Sampling and the Nyquist Condition

Sampling
120

100

80

60

40

20

0 0 20 40 60 80 100 120

real space

zero filled

22.058 - lecture 5, Sampling and the Nyquist Condition

Sinc interpolation

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.

22.058 - lecture 5, Sampling and the Nyquist Condition

Filtering We can also emphasis the high frequency components.

Weighting function in k-space.

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 )

i perfect (k ) = [O(k ) PSF ( k )] an "inverse" filter

1 PSF (k )

I perfect (x) = [O(x) PSF (x) + N (x)] PSF 1 (x ) 1 4 24 3


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:
i(k ) = O(k ) PSF ( k ) 1 n( 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 1444 4 24444 3 normally

This is avoided by employing a Wiener filter.


PSFw (k ) = PSF * (k ) PSF (k ) + WN (k )
2

where * is the complex conjugate

noise power spectral density = S

( N (k ))

( N)
S

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. Need information
frames lines pixels 500 650 = 9.75 10 6 impulse sec sec frame line f 4.875 MHz

30

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 ikx dx

One trick to this is to express the comb function as a Fourier series expansion, not the transform.
Comb(x) = where
i 2 nx 1 2 X dx a n = Comb(x)e X x 2 x

a e
n n =

i 2 nx

Normalization to keep 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 2to delta function.
x 2 the

comb function contains only a single


x

i 2 nx 1 2 X a n = (x )e dx X x 2 14 4 244 3

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

an =

1 X

A series representation of the comb function is

1 Comb(x) = e X
n =

i 2 nx

22.058 - lecture 5, Sampling and the Nyquist Condition

Fourier Transform of a Comb Function


Now,
F{Comb}
1 = e e dx X 1 dx = e X 14 24 3
i 2 nx X ikx n = 2 n ix k X n = 2 n 2 k X

2n 2 (x nX ) k X X

2 X

2 X

Note: Scaling laws hold

22.058 - lecture 5, Sampling and the Nyquist Condition

S-ar putea să vă placă și