2011. 1002. b. sampling fourier
DESCRIPTION
nnnTRANSCRIPT
Sampling theory
Fourier theory made easy
Sampling, FFT Sampling, FFT and Nyquist and Nyquist FrequencyFrequency
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-8
-6
-4
-2
0
2
4
6
8
5*sin (24t)
Amplitude = 5
Frequency = 4 Hz
seconds
A sine wave
We take an ideal sine wave to discuss effects of sampling
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-8
-6
-4
-2
0
2
4
6
8
5*sin(24t)
Amplitude = 5
Frequency = 4 Hz
Sampling rate = 256 samples/second
seconds
Sampling duration =1 second
A sine wave signal and correct sampling
We do sampling of 4Hz with 256 Hz so sampling is much higher rate than the base frequency, good
Thus after sampling we can reconstruct the original signal
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2
-1.5
-1
-0.5
0
0.5
1
1.5
2sin(28t), SR = 8.5 Hz
An undersampled signal
Undersampled signal can confuse you about its frequency when reconstructed. Because we used to small frequency of sampling. Nyquist teaches us what should be a good frequency
Sampling rate
Undersampling can be confusingHere it suggests a different frequency of sampled signal
Red dots represent the sampled data
Here sampling rate is 8.5 Hz and the frequency is 8 Hz
The Nyquist Frequency
1. The Nyquist frequency is equal to one-half one-half of the sampling frequency.of the sampling frequency.
2. The Nyquist frequency is the highest frequency that can be measured that can be measured in a signal.
Nyquist invented method to have a good sampling frequency
We will give more motivation to Nyquist and next we will prove it
http://www.falstad.com/fourier/j2/
Fourier series is for periodic signals
• As you remember, periodic functions and signals may be expanded into a series of sine and cosine functions
The Fourier TransformFourier Transform• A transform takes one function (or signal)
and turns it into another function (or signal)
The Fourier Transform
• A transform takes one function (or signal) and turns it into another function (or signal)
• Continuous Fourier Transform:
close your eyes if you don’t like integrals
The Fourier Transform
• A transform takes one function (or signal) and turns it into another function (or signal)
• Continuous Fourier Transform:
dfefHth
dtethfH
ift
ift
2
2
• A transform takes one function (or signal) and turns it into another function (or signal)
• The Discrete Fourier Transform:
The Fourier Transform
1
0
2
1
0
2
1 N
n
Niknnk
N
k
Niknkn
eHN
h
ehH
FastFast Fourier Transform1. The Fast Fourier Transform (FFT) is a very efficient algorithm very efficient algorithm for
performing a discrete Fourier transform
2. FFT principle first used by Gauss in 18??
3. FFT algorithm published by Cooley & Tukey in 1965
4. In 1969, the 2048 point analysis of a seismic trace took 13 ½ hours. • Using the FFT, the same task on the same machine took 2.4 seconds!
• We will present how to calculate FFT in one of next lectures.5. Now you can appreciate applications that would be very difficult
without FFT.
Examples of Examples of FFTFFT
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2
-1
0
1
2
0 20 40 60 80 100 1200
50
100
150
200
250
300
Famous Fourier Transforms
Sine wave
Delta function
In timeIn time
In frequencyIn frequencyCalculated in real time by software that you can download from Internet or Matlab
Famous Fourier Transforms
0 5 10 15 20 25 30 35 40 45 500
0.1
0.2
0.3
0.4
0.5
0 50 100 150 200 2500
1
2
3
4
5
6
Gaussian
Gaussian
In timeIn time
In frequencyIn frequency
Famous Fourier Transforms
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1-0.5
0
0.5
1
1.5
-100 -50 0 50 1000
1
2
3
4
5
6
Sinc function
Square wave
In timeIn time
In frequencyIn frequency
Famous Fourier Transforms
Sinc function
Square wave
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1-0.5
0
0.5
1
1.5
-100 -50 0 50 1000
1
2
3
4
5
6
In timeIn time
In frequencyIn frequency
Famous Fourier Transforms
Exponential
Lorentzian
0 50 100 150 200 2500
5
10
15
20
25
30
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 20
0.2
0.4
0.6
0.8
1
In timeIn time
In frequencyIn frequency
FFT of FID1. If you can see your NMR spectra on a computer it’s because they are in a
digital format.
2. From a computer's point of view, a spectrum is a sequence of numbers.
3. Initially, before you start manipulating them, the points correspond to the nuclear magnetization of your sample collected at regular intervals of time.
4. This sequence of points is known, in NMR jargon, as the FID (free induction decay).
5. Most of the tools that enrich iNMR are meant to work in the frequency domain; they are disabled when the spectrum is in the time domain.
6. Indeed, the main processing task is to transform the time-domain FID into a frequency-domain spectrum.
FFT of FID
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2
-1
0
1
2
0 20 40 60 80 100 1200
10
20
30
40
50
60
70
f = 8 Hz SR = 256 HzT2 = 0.5 s
SR=sampling rate
In timeIn time
In frequencyIn frequency
2exp2sin
TtfttF
T2=0.5s
FFT of FID
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2
-1
0
1
2
0 20 40 60 80 100 1200
2
4
6
8
10
12
14
f = 8 HzSR = 256 HzT2 = 0.1 s
In timeIn time
In frequencyIn frequency
Effect of change of T2 from previous slide
2exp2sin
TtfttF
T2=0.1s
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2
-1
0
1
2
0 20 40 60 80 100 1200
50
100
150
200
f = 8 Hz SR = 256 HzT2 = 2 s
In timeIn time
In frequencyIn frequency
Effect of change of T2 from previous slide
FFT of FID
2exp2sin
TtfttF
T2 = 2s
Effect of Effect of changing sample changing sample raterate
0 10 20 30 40 50 600
10
20
30
40
50
60
70
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2
-1
0
1
2
0 10 20 30 40 50 600
5
10
15
20
25
30
35
f = 8 Hz T2 = 0.5 s
In timeIn time
In frequencyIn frequency
Change of sampling rate, we see pulses
Effect of changing sample ratechanging sample rate
0 10 20 30 40 50 600
10
20
30
40
50
60
70
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2
-1
0
1
2
0 10 20 30 40 50 600
5
10
15
20
25
30
35
SR = 256 HzSR = 128 Hz
f = 8 HzT2 = 0.5 s
In timeIn time
In frequencyIn frequency
SR = 256 kHz SR = 128 kHz
• Lowering the sample rate:– Reduces the Nyquist
frequency, which• Reduces the
maximum measurable frequency
• Does not affect the frequency resolution
Circles appear more often
Peak for circles and crosses in the same frequency
Effect of changing Effect of changing sample ratesample rate
• Lowering the sample rate:– Reduces the Nyquist frequency, which
• Reduces the maximum measurable frequency• Does not affect the frequency resolution
To remember
Effect of changing sampling duration
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2
-1
0
1
2
0 2 4 6 8 10 12 14 16 18 200
10
20
30
40
50
60
70
f = 8 Hz T2 = .5 s
In timeIn time
In frequencyIn frequency
Effect of reducing the sampling duration from ST = 2s to ST = 1s
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2
-1
0
1
2
0 2 4 6 8 10 12 14 16 18 200
10
20
30
40
50
60
70
ST = 2.0 sST = 1.0 s
f = 8 HzT2 = .5 s
In timeIn time
In frequencyIn frequency
ST = Sampling Time duration
• Reducing the sampling duration:– Lowers the frequency resolution– Does not affect the range of frequencies you can measure
Effect of changing sampling duration
• Reducing the sampling duration:– Lowers the frequency resolution– Does not affect the range of frequencies you
can measure
To remember
Effect of changing sampling duration
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2
-1
0
1
2
0 2 4 6 8 10 12 14 16 18 200
50
100
150
200
f = 8 Hz T2 = 2.0 s
In timeIn time
In frequencyIn frequency
T2 = 20 s
Effect of changing sampling duration
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-2
-1
0
1
2
0 2 4 6 8 10 12 14 16 18 200
2
4
6
8
10
12
14
ST = 2.0 sST = 1.0 s
f = 8 Hz T2 = 0.1 s
In timeIn time
In frequencyIn frequency
T2 = 0.1s
Measuring multiple frequenciesMeasuring multiple frequencies
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-3
-2
-1
0
1
2
3
0 20 40 60 80 100 1200
20
40
60
80
100
120
f1 = 80 Hz, T21 = 1 s f2 = 90 Hz, T22 = .5 sf3 = 100 Hz, T23 = 0.25 s
SR = 256 Hz
In timeIn time
In frequencyIn frequencyconclusion: you can read the main frequencies which give you the value of your NMR signal, for instance logic values 0 and 1 in NMR –based quantum computing
Good sampling is important for accuracy
Measuring multiple frequencies
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2-3
-2
-1
0
1
2
3
0 20 40 60 80 100 1200
20
40
60
80
100
120
f1 = 80 Hz, T21 = 1 s f2 = 90 Hz, T22 = .5 sf3 = 200 Hz, T23 = 0.25 s
SR = 256 Hz
In timeIn time
In frequencyIn frequency
Sampling Sampling Theorem of Theorem of
NyquistNyquist
Nyquist Sampling TheoremNyquist Sampling TheoremContinuous signal:
Shah function (Impulse train):
xf
x
Sampled function:
n
s nxxxfxsxfxf 0
xs
x0x
n
nxxxs 0
projected
Sampled and discretized Multiplication in image domain
Sampling Theorem: multiplication in image domain is Sampling Theorem: multiplication in image domain is convolution in spectralconvolution in spectral
Sampled function:
n
s nxxxfxsxfxf 0
FS u F u S u F u 1x0
u nx0
n
uF
maxu
A
u
uFS
maxu
0xA
0
1x
u
Only if0
max 21x
u
Sampling frequency 0
1xShah function
(Impulse train):
image
We do not want trapezoids to overlap
Nyquist TheoremNyquist TheoremIf
0max 2
1x
u uFS
maxu
0xA
0
1x
u
Aliasing
When can we recover from ? uF uFS
Only if0
max 21x
u (Nyquist Frequency)
We can use
otherwise0
21
00 xux
uC
Then uCuFuF S uFxf IFTand
Sampling frequency must be greater than max2u
Nyquist Theorem;Nyquist Theorem;We can recover F(u) from Fs(u) when the sampling frequency is greatergreater than 2 u max
Aliasing in 2D image
Low frequencies
High frequencies
Some useful links
• http://www.falstad.com/fourier/– Fourier series java applet
• http://www.jhu.edu/~signals/– Collection of demonstrations about digital signal processing
• http://www.ni.com/events/tutorials/campus.htm– FFT tutorial from National Instruments
• http://www.cf.ac.uk/psych/CullingJ/dictionary.html– Dictionary of DSP terms
• http://jchemed.chem.wisc.edu/JCEWWW/Features/McadInChem/mcad008/FT4FreeIndDecay.pdf– Mathcad tutorial for exploring Fourier transforms of free-induction decay
• http://lcni.uoregon.edu/fft/fft.ppt– This presentation
ConclusionsConclusions
1. Signal (image) must be sampled with high enough frequency
2. Use Nyquist theorem to decide3. Using two small sampling frequency leads to
distortions and inability to reconstruct a correct signal.
4. Spectrum itself has high importance, for instance in reading NMR signal or speech signal.