# Fourier Series and Transform

Overview
Why Fourier transform? Trigonometric functions Who is Fourier? Fourier series Fourier transform Discrete Fourier transform Fast Fourier transform 2D Fourier transform Tips

Why Fourier transform?

Fourier, not being noble, could not enter the artillery, although he was a second Newton. ⎯ Francois Jean Dominique Arago
For signal processing, Fourier transform is the tool to connect the time domain and frequency domain. Why would we do the exchange between time domain and frequency domain? Because we can do all kinds of useful analytical tricks in the frequency domain that are just too hard to do computationally with the original time series in the time domain. Simplify the calculation.

Why Fourier transform?

f (t ) = sin( 2π * 50t )

The left picture is the sound signal changing with time. we know that this sound is generated at 50Hz and 120Hz mixed with other noises. we have no any idea about this sound by the time record.Why Fourier transform? This example is a sound record analysis. By the Fourier transform. . However.

cosx. cos2x.Trigonometric functions (ex. …. (cos θ ) ' = − sin θ Trigonometric system is the orthogonal system π −π ∫ cos nxdx = 0.1) Trigonometric system is the periodic functions as: 1. π π −π ∫ sin nxdx = 0 π −π ∫ sin mx cos nxdx = 0 ⎧0 ∫ cos mx cos nxdx = ⎨ −π ⎩π m≠n m=n ⎧0 ∫ sin mx sin nxdx = ⎨ −π ⎩π π m≠n m=n . sinnx. …. sin2x. The properties of trigonometric system cosθ cos φ = cos(θ − φ ) / 2 + cos(θ + φ ) / 2 sin θ sin φ = cos(θ − φ ) / 2 − cos(θ + φ ) / 2 (sin θ ) ' = cos θ . sinx. cosnx.

a.a.b.a. the integrand evaluated at each element of x. q = ∫ f ( x)dx q=quad(fun. The function y=fun(x) should accept a vector argument x and return a vector result y. fun is a function handle for either an M-file function or an anonymous function. that is. ∫ f ( x)dx a b q=quad(fun.b) q=quad(fun. a b .tol) [q.…) Quadrature is a numerical method used to find the area under the graph of a function. to compute a definite integral.a.b) if f is a symbolic expression.In Matlab Int(f) Int(f.b.b) tries to approximate the integral of function fun from a to b to within an error of 1e-6 using recursive adaptive Simpson quadrature.a.fcnt]=quad(fun.

Not translated into English until 1878! But it’s true!! . Don’t believe it? Neither did Lagrange. historians. 1768~1830). Jean Baptiste Joseph Fourier (France. He went to Egypt with Napoleon as the Governor of Lower Egypt after the 1798 Expedition. and mathematicians. Poisson and other big wigs. Later he joined the faculty at Ecole Normale and then the Polytechnique in Paris when he is 27. He graduated with honors from the military school in Auxerre and became a teach of math when he was 16 years old. He was secretary of the Academy of Sciences in 1816 and Fellow in 1817. Laplace.Who is Fourier? Fourier is one of the France’s greatest administrators.

sin(nx) and cos(nx) have period 2π/n. The linear combination of these functions or multiply each by a constant. . the adding result still has a period 2π.Fourier’s basic idea Trigonometric functions: sin(x) and cos(x) has the period 2π.

we can describe the f(x) in terms of an infinite sum of sines and cosines a0 ∞ f ( x ) = + ∑ ( am cos mx + bm sin mx ). we can get am = bm = a0 = 1 π π 1 −π π ∫ f ( x ) cos mxdx π 1 −π ∫ f ( x) sin mxdx π π −π ∫ f ( x)dx . we multiply above equation by cosmx or sinmx and integrate it over interval -π<x<π. 2 m=1 To find the coefficients a. b and a. By the orthogonality relations of sin and cos functions.Fourier series For any function f(x) with period 2π (f(x) = f(2π +x)).

nπ 1 1 mπ 0 =− sin mx 0 + sin mx − mπ mπ mπ =0 bk = 0 . am = 1 π ∫ cos mxdx + 0 1 π −π ∫ ( −1) cos mxdx 0 4 .5.. 4 .6 .Fourier series Period function example (ex...2) ⎧ 1 f ( x) = ⎨ ⎩− 1 0< x <π −π < x < 0 The parameters are 1π 1 0 a0 = ∫ 1dx + ∫ ( −1)dx = 0 1π 1 0 a1 = ∫ cos xdx + ∫ ( −1) cos xdx π 0 π 1 −π π 0 π −π =− =0 1 π π sin x 0 − π 1 π sin x −π 0 bm = bn = π π −π ∫ f ( x ) sin mxdx n = 1. k = 2 .) π 1 3 5 ..3... f ( x) = 4 sin x sin 3 x sin 5 x ( + + + ..

.) π 1 3 5 .Fourier series Period function example (cont…) ⎧ 1 f ( x) = ⎨ ⎩− 1 0< x <π −π < x < 0 The Fourier series is: f ( x) = 4 sin x sin 3 x sin 5 x ( + + + ..

..Fourier series Period function example (cont…) ⎧ 1 f ( x) = ⎨ ⎩− 1 0< x <π −π < x < 0 The Fourier series is: f ( x) = 4 sin x sin 3 x sin 5 x ( + + + .) π 1 3 5 + = .

) π 1 3 5 + = ..Fourier series Period function example (cont…) ⎧ 1 f ( x) = ⎨ ⎩− 1 0< x <π −π < x < 0 The Fourier series is: f ( x) = 4 sin x sin 3 x sin 5 x ( + + + ..

.) π 1 3 5 + = .Fourier series Period function example (cont…) ⎧ 1 f ( x) = ⎨ ⎩− 1 0< x <π −π < x < 0 The Fourier series is: f ( x) = 4 sin x sin 3 x sin 5 x ( + + + ..

..) π 1 3 5 .Fourier series Period function example (cont…) ⎧ 1 f ( x) = ⎨ ⎩− 1 0< x <π −π < x < 0 The Fourier series is: f ( x) = 4 sin x sin 3 x sin 5 x ( + + + .

Fourier series Period function example f ( x) = x 0 < x < 2π The parameters are f ( x ) = π − 2( sin x sin 2 x sin 3 x + + + ...) 1 2 3 .

. . where 2 T /2 a0 = ∫ f ( x' )dx' T −T / 2 2 T /2 2π am = x ' ) dx ' ∫ f ( x ' ) cos( m −T / 2 T T 2 T /2 2π bm = ∫ f ( x' ) sin( m x' )dx' T −T / 2 T Replace ω 2π/T and x’ t.. f (t ) = a0 ∞ + ∑ (am cos mωt + bm sin mωt ). 2 . a simple change of variables can be used to transform the interval of integration from [π.2.T/2] as x= 2π x' . π] to [-T/2. T dx = 2π dx' T The f(x’) can be described by the Fourier series as f ( x') = a0 ∞ 2π 2π + ∑ ( a m cos( m x ' ) + bm sin( m x ' ) ). 2 m=1 m = 1....Fourier series general For any function f(x’) with arbitrary period T .. T P 2 m =1 m = 1.

e ikωt + e −ikωt e ikωt − e −ikωt ak cos kωt + bk sin kωt = ak + bk 2 2i a − ibk ikωt ak + ibk −ikωt e + e = k 2 2 Denoting that as c0 = a0 a − ibk a + ibk . ck = k .The complex form of Fourier series Euler formulae e ix = cos x + i sin x ⎫ cos x = (e ix + e −ix ) / 2 ⎬⇒ −ix e = cos x − i sin x ⎭ sin x = (e ix − e −ix ) / 2i Fourier series ∞ a a b f (t ) = 0 + ∑ ( m ( e im ω t + e − im ω t ) + m ( e im ω t − e − im ω t ) ) 2 m =1 2 2i For certain m=k. c− k = k 2 2 2 ∞ ∞ The complex form of Fourier series f (t ) = c 0 + ∑ ( c k e ikω t + c − k e − ik ω t ) = ∑ c k e ikω t k =1 k = −∞ ck = 2 T /2 − ik ω t ∫ f (t ) e dt T −T / 2 .

. F(ω) is called as the Fourier Transform of f(t). Equation of f(t) is called the inverse Fourier Transform. rewrite previous general Fourier series equation and get: 2 T /2 f (t ) = ∑ ( ∫ f (t )e −ikωt dt )e ikωt k = −∞ T −T / 2 T = 2π / ω 1 ∞ T /2 ikω ( t −ξ ) → dξ ∑ ω ∫ f (ξ )e ∞ π k =−∞ −T / 2 → Define ∞ 1 ∞ i ωt −iωξ ∫ e dω ∫ f (ξ )e dξ −∞ 2π −∞ F (ω ) = ∫ f (t )e −iωt dt −∞ ∞ 1 ∞ i ωt f (t ) = ∫ F (ω )e dω 2π −∞ Here.Fourier transform For any non-periodic function and assume T ∞.

Fourier transform Parseval’s law The time signal squared f2(t) represents how the energy contained in the signal distributes over time t. while its spectrum squared F2(ω) represents how the energy distributes over frequency (therefore the term power density spectrum). Obviously. the same amount of energy is contained in either time or frequency domain. as indicated by Parseval’s formula: ∞ −∞ ∫ f (t ) dt = ∫ F (ω ) dω 2 2 −∞ ∞ .

g(x).Similarity property: g(x)=f(ax) 1 ω G (ω ) = F ( ) a a -Shift formula: given g(x) = f(x+b) G (ω ) = e iωb F (ω ) .Derivative formula: FT ( f ' ( x)) = iωF (ω ) .Fourier transform properties The properties of Fourier transfrom .Linearity property: given f(x). FT (af ( x) + bg ( x)) = aF (ω ) + bG (ω ) .

This represents 1 ∞ iω x f ( x) = ∫ F (ω )e dω 2π −∞ . This represents F (ω ) = ∫ f ( x)e −iωx dx −∞ ∞ f = ifourier(F) This is the inverse Fourier transform of the symbolic scalar F with default independent variable ω. The default return is a function of x. The default return is a function of ω.In Matlab F = fourier(f) This is the Fourier transform of the symbolic scalar f with default independent variable x.

4) Define the frequency sampling points ωn=2πn/T. 2) Define the sample points tk = k(∆T) for k = 0. where 2πn/T is termed as the fundamental frequency. we can do following steps: 1) Assume the sampling window is T. 3) Define the signal values at each sampling points as fk=f(tk).Discrete Fourier Transform (DFT) Discrete Fourier Transform can be understood as a numerical approximation to the Fourier transform. . …. To convert the integral Fourier Transform (FT) into the Discrete Fourier Transform (DFT). The number of sampling points is N. This is used in the case where both the time and the frequency variables are discrete (which they are if digital computers are being used to perform the analysis). Define the sample interval ∆T=Ts=T/N. (N-1).

..1.1.. The inverse Discrete Fourier Transform is defined as 1 f (tk ) = N ∑ F (ω )e ω i n=0 n N −1 n tk .. N − 1 This is the Discrete Fourier Transform. N − 1 . 2..2.. The answer is F (ωn ) = ∫ e −iωnt f (t )dt . k =0 N −1 n = 0..... k = 0. −∞ ∞ n = 0...Discrete Fourier Transform (DFT) 5) Consider the problem of approximating the FT of f at the points ωn=2πn/T. ( N − 1) 6) Approximate this integral by Riemann sum approximation using the points tk since f~0 for t>T: F (ωn ) = ∑ f (t k )e −iωntk .

4096. This algorithm reduces the computation time of DFT for N points from N2 to Nlog2(N) (This algorithm is called Butterfly algorithm.Fast Fourier Transform (FFT) Fast Fourier Transform (FFT) is a effective algorithm of Discrete Fourier Transform (DFT) and developed by Cooley and Tukey at 1965.). Zero padding at the end of the data set if the sampling number is not equal to the exact the power of 2. . The only requirement of this algorithm is that number of point in the series have to be a power of 2 (2n points) such as 32. 1024.

Y = ifft(X. computed with a fast Fourier transform (FFT) algorithm. X is padded with trailing zeros to length n.n) This command returns the n-point DFT of X. . Y = ifft(X) This command returns the inverse discrete Fourier transform (DFT) of X. If the length of X is less than n.In Matlab Y = fft(X) This command returns the discrete Fourier transform (DFT) of X. Y = fft(X.n) This command returns the n-point inverse DFT of X. the sequence X is truncated. computed with a fast Fourier transform (FFT) algorithm. If the length of X is greater than n.

Fourier transform Delta function Delta function ⎧1 t = 0 f (t ) = δ (t ) = ⎨ ⎩0 others .

Fourier transform Unit function Uniform function f (t ) = 1 .

Fourier transform Sin function example : g(t) = sin(2πf t) + (1/3)sin(2π3f t) = + .

Fourier transform Sin function example : g(t) = sin(2πf t) + (1/3)sin(2π 3f t) = + .

Fourier transform cos functions Cos function f (t ) = cos(2π * 50t ) .

⇒ R (ω ) = V0 (ω ) S (ω ) FFT .Applications convolution The time domain recorded waveform is a convolution product: r (t ) = ∫ v0 (t − τ ) s (τ )dτ −∞ ∞ Simplify the complex convolution product into the direct multiply in the frequency domain by Fourier transform.

Applications convolution The simulated DI water waveform and ethanol waveform at room temperature by FFT. .

y ) = F ( u . y )e −i ( ux + vy ) dxdy . v ) e i ( ux + vy ) dudv .2D Integral Fourier transform 2D integral Fourier transform is F (u. −∞ −∞ ∞ ∞ Inverse 2D Fourier transform is 1 ∞ ∞ f ( x. v ) = ∫ ∫ f ( x. ∫ ∫ 2π − ∞ − ∞ .

DFT is F (um . y yk )e n yk ⎤ e −ium x xk ⎥ ⎦ ⎣ m =0 ⎢ n =0 M −1 N −1 F (um .. vn ) = ∑ ∑ f ( x xk .2D Discrete Fourier transform For 2D function f(x.. M − 1 n = 0..2.. m = 0.1.1.2. y yk )e xk = 0 yk =0 M −1 N −1 −i ( um x xk + vn y yk ) ..y). N − 1 Rewrite above equation −iv y F (um . v )e −ium x xk m =0 M −1 We can implement 2D Fourier transform as a sequence of 1-D Fourier transform operations: ... vn ) = ∑ ⎡ ∑ f ( x xk .. vn ) = ∑ F ( x.

vn )e m =0 n =0 M −1N −1 −i ( um x xk + vn y yk ) . y yk ) = ∑ F ( x xk .y). y yk ) = ∑ ∑ F (um .1..2. vn )e m xk MN m=0 We can implement 2D inverse Fourier transform as a sequence of 1-D inverse Fourier transform operations: [ ] . M − 1 yk = 0.2D Inverse Discrete Fourier transform For 2D function f(x. y yk ) = e ium xxk ∑ ∑ F (um .. xk = 0..... N − 1 Rewrite above equation 1 M −1 N −1 ivn y yk f ( x xk .. vn )e MN m=0 n=0 1 M −1 −iu x f ( x xk .1.. inverse DFT is f ( xxk .2.

g(x.2D Fourier transform properties The properties of Fourier transfrom .by) G (u.y+b) G (u. v) + bG (u . v) = .Linearity property: given f(x. v) = e i ( ua+vb ) F (u.y)=f(ax.Shift formula: given g(x.Similarity property: g(x.y). y )) = aF (u . v) . v) . v) ⋅ H (u . y ) = G (u .y) = f(x+a. v) .y). y ) ∗ h( x.Convolution u v 1 F( . y ) + bg ( x. FT (af ( x. ) ab a b g ( x.

In Matlab Y = fft2(X) This command returns the discrete Fourier transform (DFT) of X(x.m.m. .n) This command returns the n-point DFT of X(x. Y = fft2(X.y). Y = ifft2(X. computed with a fast Fourier transform (FFT) algorithm. Y = ifft2(X) This command returns the inverse discrete Fourier transform (DFT) of X.y) with the certain length of x at m and y at n.n) This command returns the m-point of x and n-point of y inverse DFT of X(x. computed with a fast Fourier transform (FFT) algorithm.y).

Image Compression (JPEG) .

JPEG compression comparison 89k 12k .

f NF = 1 2∆t The total sampling period is T. Nyquist frequency represents the highest frequency of the signal we can see in the frequency domain.Tips Nyquist frequency Nyquist frequency is called the highest frequency that can be coded at a given sampling rate in order to be able to fully reconstruct the signal. This represent the lowest frequency of the signal we can see in the frequency domain. Then. . On the other hand. the base frequency is 2/T.

Tips Sampling rate/sampling total time Sampling rate is the sampling interval. Sampling total time is the total time period we looked to sampling the data. . This will control the lowest frequency band. This will control the highest frequency band. However. Please notice that we can extend the sampling total time by padding zero for FFT. it can not change the highest frequency. This will change the lower frequency resolution.

Tips windows f (t ) = sin(2π *5t ) Any sampling data range is limited/finite. = + .

the transformed the signal is the convolution products of F(ω) and WIN(ω). . F ' (ω ) = F (ω ) ∗ WIN (ω ) For the true transformed the signal. After the Fourier transform. we have to de-convolution of the transformed the results.Tips windows f (t ) = sin(2π *5t ) The true sampling signal is f’(t) = f(t)·win(t).

5*cos(2*pi*200t). 3) choosing two different window length to get the sense of how these different sampling will influence on your Fourier transform results in frequency domain. Please practice with: 1) choosing two different sampling rate (how many points you sampled in total in time domain N). and f2(x) = cos(2*pi*500t)+2*sin(2*pi*1000t)+0. . 2) choosing two different sampling interval (delta_t).The Homework of Fourier transform is using Matlab: Do the Fourier transform of one simple harmonic function f1(x)=sin(2*pi*500t).

Sign up to vote on this title