2/9/11
1
PHYS 352
Intro Signal Processing: Fourier Transforms and Sampling
any† periodic function with period T (and f0 =1/T) can be represented as an infinite sum:
re-writing gives:
create a purely mathematical artifact → negative frequencies:
Fourier Series
2/9/11
2
exponential form is useful since math with exponential functions is simpler than with trig functions and you take care of sine and cosine together (i.e. magnitude and phase)
magnitude of frequency component nf0 is: phase of frequency component nf0 is:
which is just the phase angle of cn
Fourier Coefficients
an = cn+c-n = 2 Re cn a0 = c0 bn = j(cn-c-n) = 2 Im cn
Example: Fourier Coefficients
2/9/11
3
Example cont'd
magnitude phase
Example cont'd let's plug in some real numbers, let's pick
x = 0, τ = T/5 and A = 1; w = 2π/T coefficients are:
2/9/11
4
let n/T→k and let T→∞ (periodic pulse train becomes a single pulse); then k becomes continuous; cnT→ F(k)
with:
note: ω = 2πk and
F(ω) is the frequency spectrum easy to transform back and forth from time domain to frequency domain
Fourier Transform
electrical engineering convention: most physics texts use: for both
symmetry between time and frequency square wave to sinc function sinc(x) =
time frequency square sinc sinc square delta constant constant delta impulse train frequency domain periodic spikes cosine/sine two, real/imaginary, even/odd, d functions f(t-t0)
Fourier Transform Pairs
sinc(x)
2/9/11
5
Sampling: Key Fourier Transforms impulse train: infinite periodic pattern of delta functions, also called a
Dirac comb
convolution theorem: Fourier transform of the convolution of two functions is the product of their separate Fourier transforms and vice versa
sums to zero unless ωT=2π
F
consider a signal which has limited bandwidth (all frequency content f<fmax)
sampling is like applying an “impulse train” function
What Happens When Sampled?
2/9/11
6
previous page mathematically – boils down to the shifting property of the delta function under convolution
if fs < 2 fmax, aliasing occurs
Nyquist criterion: must sample at over twice fmax to preserve signal content
Nyquist-Shannon Sampling Theorem
Frequency Limited Signals can use samples to determine Fourier
coefficients if the frequency content is limited if Fourier series has nmax then f0*nmax is
maximum frequency contained in the signal contents
need to determine 2 nmax+1 coefficients (nmax complex values and 1 for c0) and hence need the same number of samples to generate that many linear equations
of course, that's consistent with the sampling theorem
2/9/11
7
Sampling Example f0 = 1 Hz, fmax = 2 Hz thus nmax = 2; need 5 samples sampling frequency fs = 5 Hz, Δt = 0.2 s 5 samples are: [0 1 0 −1 0] t=0: 0 = a0 + a1 cos(0) + b1 sin(0) + a2 cos(0) + b2
sin(0) t=0.2: 1 = a0 + a1 cos(0.4π) + b1 sin(0.4π) + a2 cos(0.8π) + b2
sin(0.8π) t=0.4: 0 = a0 + a1 cos(0.8π) + b1 sin(0.8π) + a2 cos(1.6π) + b2
sin(1.6π) t=0.6: −1 = a0 + a1 cos(1.2π) + b1 sin(1.2π) + a2 cos(2.4π) + b2
sin(2.4π) t=0.8: 0 = a0 + a1 cos(1.6π) + b1 sin(1.6π) + a2 cos(3.2π) + b2
sin(3.2π) solve linear system (e.g. re-write as a matrix equation,
invert the matrix using MATLAB to get a0, a1, b1, a2, b2) a0= 0, a1=0.4472, b1=0.6155, a2=−0.4472, b2=−0.1453
solving K equations for K samples is not the way one normally determines Fourier coefficients
integrating over one period times 1/T → averaging over the samples for one period, when discrete
becomes
discrete Fourier transform
Coefficients: Sampling
2/9/11
8
Reprise: Sampling Example
sample K times in one period T; T = K Δt
previous example: K = 5 samples, (K−1)/2 coefficients of cn, plus c0
when you use MATLAB [c0 c1 c2 c3 c4] is returned when samples [f1 f2 f3 f4 f5] and one can show that c3 = c2* and c4 = c1*
note also: MATLAB does not include factor 1/K (# of samples)
Discrete Fourier Transform
2/9/11
9
FFT's are algorithms that decrease the number of computations to perform a discrete Fourier transform # computations: reduced from O(N2) to O(N log N)
generally based upon factorization of N, where N is the number of samples; however, note that even when N is a prime number, there are FFT algorithms that achieve the above computational reduction
how do the algorithms work? too much detail for this course
Fast Fourier Transform
when you know the Fourier coefficients and want the value of the function
→
FFT algorithms work on the inverse DFT also note: the upper half of the cm coefficients are the
complex conjugates of the lower half (negative frequencies)
note also: MATLAB includes factor 1/K (# of samples)
Inverse DFT
2/9/11
10
Recap: for Math Wonks Fourier transform
continuous in time and frequency domain
Fourier series continuous and periodic in time, discrete in
frequency
Discrete-Time Fourier Transform discrete in time, continuous and periodic in
frequency we did not discuss
Discrete Fourier Transform both are discrete (time and frequency) both are finite, but are periodic if extended
DFT Example of Use signal waveform is sampled
501 samples every 1 µs, starting at t=0 s, until t=500 µs and that’s T=500 µs
get the DFT using an FFT algorithm each frequency step is: 1/T = 2000 Hz there will be 250 frequency components plus c0
each of those c1 to c250 is complex, has real and imaginary values, thus has 500 values
or think 250 positive frequencies and 250 negative
maximum frequency is: 250(2000) = 500 kHz note: sampling frequency was 1 MHz, twice the
maximum frequency, so Mr. Nyquist is happy summary: 501 time domain samples generated 501
frequency domain values
2/9/11
11
DFT Even Number of Samples say you have and even number of samples, what are
the frequency components? 20 samples, say every 1 ms; T = 20 ms
f0 = 1/T = 50 Hz fs = 1 kHz
you expect 20 “complex” numbers from the DFT #1 is the DC coefficient (c0, real-valued) #2 to #10 are the c1 to c9 complex-valued coefficients #11 is the c10 coefficient and it will be real #12 to #20 are the c9 to c1 complex conjugates
TOTAL: 9 complex values + 2 real values = 20 real quantities from the DFT
fmax = 10*f0 = 500 Hz that’s ½ of fs