Fourier Series and Fourier Transform

Similar documents
Math 489AB A Very Brief Intro to Fourier Series Fall 2008

Topics in Fourier analysis - Lecture 2.

be the set of complex valued 2π-periodic functions f on R such that

A glimpse of Fourier analysis

Math 115 ( ) Yum-Tong Siu 1. Derivation of the Poisson Kernel by Fourier Series and Convolution

Examples of the Fourier Theorem (Sect. 10.3). The Fourier Theorem: Continuous case.

General Inner Product and The Fourier Series

Fourier Series. (Com S 477/577 Notes) Yan-Bin Jia. Nov 29, 2016

Mathematics for Chemists 2 Lecture 14: Fourier analysis. Fourier series, Fourier transform, DFT/FFT

Jim Lambers ENERGY 281 Spring Quarter Lecture 5 Notes

Numerical Methods I Orthogonal Polynomials

Math 121A: Homework 6 solutions

INTRODUCTION TO REAL ANALYSIS II MATH 4332 BLECHER NOTES

Recall that any inner product space V has an associated norm defined by

7: FOURIER SERIES STEVEN HEILMAN

Periodic functions: simple harmonic oscillator

A quadratic expression is a mathematical expression that can be written in the form 2

Physics 250 Green s functions for ordinary differential equations

FOURIER SERIES, HAAR WAVELETS AND FAST FOURIER TRANSFORM

FOURIER TRANSFORMS. 1. Fourier series 1.1. The trigonometric system. The sequence of functions

Finite-dimensional spaces. C n is the space of n-tuples x = (x 1,..., x n ) of complex numbers. It is a Hilbert space with the inner product

swapneel/207

CONVERGENCE OF THE FOURIER SERIES

Chapter 6: Fast Fourier Transform and Applications

Note: Final Exam is at 10:45 on Tuesday, 5/3/11 (This is the Final Exam time reserved for our labs). From Practice Test I

f(s) e -i n π s/l d s

MATH 167: APPLIED LINEAR ALGEBRA Chapter 3

Transform methods. and its inverse can be used to analyze certain time-dependent PDEs. f(x) sin(sxπ/(n + 1))

Topics in Harmonic Analysis Lecture 1: The Fourier transform

Math 5440 Problem Set 7 Solutions

Real Variables # 10 : Hilbert Spaces II

LES of Turbulent Flows: Lecture 3

Lecture 5. The Digital Fourier Transform. (Based, in part, on The Scientist and Engineer's Guide to Digital Signal Processing by Steven Smith)

MATH 5640: Fourier Series

Convergence of Fourier Series

Mathematics 104 Fall Term 2006 Solutions to Final Exam. sin(ln t) dt = e x sin(x) dx.

4 Hilbert spaces. The proof of the Hilbert basis theorem is not mathematics, it is theology. Camille Jordan

Orthonormal Systems. Fourier Series

Instructor Quick Check: Question Block 12

Vectors in Function Spaces

Convergence for periodic Fourier series

HARMONIC ANALYSIS TERENCE TAO

Homework Solutions: , plus Substitutions

Discrete Fourier Transform

Polynomial Approximation: The Fourier System

Ma 221 Eigenvalues and Fourier Series

1 + lim. n n+1. f(x) = x + 1, x 1. and we check that f is increasing, instead. Using the quotient rule, we easily find that. 1 (x + 1) 1 x (x + 1) 2 =

Consequences of Orthogonality

The Pseudospectral Method

CS711008Z Algorithm Design and Analysis

Computer Problems for Fourier Series and Transforms

1. Spaces of Functions

Lecture 2: Basics of Harmonic Analysis. 1 Structural properties of Boolean functions (continued)

Math 5587 Midterm II Solutions

Math 20B Supplement. Bill Helton. September 23, 2004

MATH 312 Section 4.5: Undetermined Coefficients

Biomedical Signal Processing and Signal Modeling

Fourier Series. Spectral Analysis of Periodic Signals

Chapter 7: Techniques of Integration

3. Fourier decomposition of functions

The discrete and fast Fourier transforms

1.3.1 Definition and Basic Properties of Convolution

Scientific Computing: An Introductory Survey

Further Mathematical Methods (Linear Algebra) 2002

8/19/16. Fourier Analysis. Fourier analysis: the dial tone phone. Fourier analysis: the dial tone phone

Hilbert Spaces. Hilbert space is a vector space with some extra structure. We start with formal (axiomatic) definition of a vector space.

Syllabus Fourier analysis

Fourier Series. 1. Review of Linear Algebra

Mathematics for Engineers II. lectures. Power series, Fourier series

From Fourier to Wavelets in 60 Slides

Lecture 1.4: Inner products and orthogonality

Tangent Lines Sec. 2.1, 2.7, & 2.8 (continued)

Introduction to Algebraic and Geometric Topology Week 3

Review of Concepts from Fourier & Filtering Theory. Fourier theory for finite sequences. convolution/filtering of infinite sequences filter cascades

Polynomials. p n (x) = a n x n + a n 1 x n 1 + a 1 x + a 0, where

Linear Algebra March 16, 2019

More on Fourier Series

Lecture 1. 1, 0 x < 1 2 1, 2. x < 1, 0, elsewhere. 1

Mathematical Methods and its Applications (Solution of assignment-12) Solution 1 From the definition of Fourier transforms, we have.

MARN 5898 Fourier Analysis.

Solutions to the Sample Problems for the Final Exam UCLA Math 135, Winter 2015, Professor David Levermore

Functional Analysis Exercise Class

1 Limits and continuity

Math 3150 HW 3 Solutions

The Dirac δ-function

Methods of Mathematical Physics X1 Homework 3 Solutions

General Inner Product & Fourier Series

Waves, the Wave Equation, and Phase Velocity. We ll start with optics. The one-dimensional wave equation. What is a wave? Optional optics texts: f(x)

Problem set 5, Real Analysis I, Spring, otherwise. (a) Verify that f is integrable. Solution: Compute since f is even, 1 x (log 1/ x ) 2 dx 1

Introduction to the FFT

Chapter 4 Sequences and Series

The O () notation. Definition: Let f(n), g(n) be functions of the natural (or real)

Outline of Fourier Series: Math 201B

BME I5000: Biomedical Imaging

Quantum Physics Lecture 8

HILBERT SPACES AND THE RADON-NIKODYM THEOREM. where the bar in the first equation denotes complex conjugation. In either case, for any x V define

Convergence of Fourier series

1 Distributions (due January 22, 2009)

Measure and Integration: Solutions of CW2

Real Analysis Notes. Thomas Goller

Transcription:

Fourier Series and Fourier Transform An Introduction Michael Figl Center for Medical Physics and Biomedical Engineering Medical University of Vienna 1 / 36

Introduction 2 / 36

Introduction We want to recall some definitions and theorems from linear algebra, mainly to clearly define the assumptions needed. 2 / 36

Some remarks on R n 3 / 36

Some remarks on R n We recall R n := {(a 1, a 2,...) : x i R} 3 / 36

Some remarks on R n We recall R n := {(a 1, a 2,...) : x i R} the standard basis consists of the vectors e i, with a 1 at position i, e i = (0,..., 0, 1, 0,..., 0) 3 / 36

Some remarks on R n We recall R n := {(a 1, a 2,...) : x i R} the standard basis consists of the vectors e i, with a 1 at position i, e i = (0,..., 0, 1, 0,..., 0) the inner product is defined by (x, y) := x i y i 3 / 36

Some remarks on R n We recall R n := {(a 1, a 2,...) : x i R} the standard basis consists of the vectors e i, with a 1 at position i, e i = (0,..., 0, 1, 0,..., 0) the inner product is defined by (x, y) := x i y i if we take a vector a = (a 1, a 2,...) we get (a, e i ) = a i 3 / 36

Some remarks on R n We recall R n := {(a 1, a 2,...) : x i R} the standard basis consists of the vectors e i, with a 1 at position i, e i = (0,..., 0, 1, 0,..., 0) the inner product is defined by (x, y) := x i y i if we take a vector a = (a 1, a 2,...) we get (a, e i ) = a i therefore a = (a, e i )e i 3 / 36

Some remarks on R n We recall R n := {(a 1, a 2,...) : x i R} the standard basis consists of the vectors e i, with a 1 at position i, e i = (0,..., 0, 1, 0,..., 0) the inner product is defined by (x, y) := x i y i if we take a vector a = (a 1, a 2,...) we get (a, e i ) = a i therefore a = (a, e i )e i 3 / 36

Some remarks on R n We recall R n := {(a 1, a 2,...) : x i R} the standard basis consists of the vectors e i, with a 1 at position i, e i = (0,..., 0, 1, 0,..., 0) the inner product is defined by (x, y) := x i y i if we take a vector a = (a 1, a 2,...) we get (a, e i ) = a i therefore a = (a, e i )e i What if we have many basis elements and don t want to sum everything up? 3 / 36

Best Approximation in R n, I 4 / 36

Best Approximation in R n, I Assume we have a vector r = N (r, e i )e i i=1 4 / 36

Best Approximation in R n, I Assume we have a vector r = N (r, e i )e i i=1 but as N is very big, we want just want to compute y = n (r, e i )e i, with n << N i=1 4 / 36

Best Approximation in R n, I Assume we have a vector r = N (r, e i )e i i=1 but as N is very big, we want just want to compute y = n (r, e i )e i, with n << N i=1 What can generally be said about y? 4 / 36

Best Approximation in R n, II r y = N i=n+1 (r, e i)e i V especially r y y y V for every y V 5 / 36

Best Approximation in R n, II r y = N i=n+1 (r, e i)e i V especially r y y y V for every y V Pythagoras theorem givens y r y r r y y V y r 2 = y r 2 + y y 2 5 / 36

Best Approximation in R n, II r y = N i=n+1 (r, e i)e i V especially r y y y V for every y V Pythagoras theorem givens y r y r r y y V y r 2 = y r 2 + y y 2 Theorem If we define V =< e i, i = 1,... n >, then y = n i=1 (r, e i)e i is the best approximation of r in V. 5 / 36

Generalisation 6 / 36

Generalisation What did we need to prove the approximation property? 6 / 36

Generalisation What did we need to prove the approximation property? an inner product space 6 / 36

Generalisation What did we need to prove the approximation property? an inner product space an orthogonal basis 6 / 36

Inner Product Space, I 7 / 36

Inner Product Space, I A not very surprising definition: 7 / 36

Inner Product Space, I A not very surprising definition: Definition (Inner Product Space) A vector space V (over the field F ), with an inner product (x, y) V V F is called an inner product space. 7 / 36

Inner Product Space, I A not very surprising definition: Definition (Inner Product Space) A vector space V (over the field F ), with an inner product (x, y) V V F is called an inner product space. The inner product is 7 / 36

Inner Product Space, I A not very surprising definition: Definition (Inner Product Space) A vector space V (over the field F ), with an inner product (x, y) V V F is called an inner product space. The inner product is symmetric (x, y) = (y, x) 7 / 36

Inner Product Space, I A not very surprising definition: Definition (Inner Product Space) A vector space V (over the field F ), with an inner product (x, y) V V F is called an inner product space. The inner product is symmetric (x, y) = (y, x) bilinear (x + λy, z) = (x, z) + λ(y, z) 7 / 36

Inner Product Space, I A not very surprising definition: Definition (Inner Product Space) A vector space V (over the field F ), with an inner product (x, y) V V F is called an inner product space. The inner product is symmetric (x, y) = (y, x) bilinear (x + λy, z) = (x, z) + λ(y, z) positive-definite x V \ {0} (x, x) > 0 7 / 36

Inner Product Space, II 8 / 36

Inner Product Space, II We can now define 8 / 36

Inner Product Space, II We can now define Definition Norm x := (x, x) 8 / 36

Inner Product Space, II We can now define Definition Norm x := (x, x) Orthogonality x y : (x, y) = 0 8 / 36

Inner Product Space, II We can now define Definition Norm x := (x, x) Orthogonality x y : (x, y) = 0 Angle x y := arccos (x,y) x y 8 / 36

Inner Product Space, Examples 9 / 36

Inner Product Space, Examples Example R n using (a, b) := a i b i 9 / 36

Inner Product Space, Examples Example using (a, b) := a i b i C[0, 1] using (f, g) := 1 0 fg R n 9 / 36

Inner Product Space, Examples Example using (a, b) := a i b i C[0, 1] using (f, g) := 1 0 fg C n using (a, b) := a i b i, sesquilinear! R n 9 / 36

Inner Product Space, Examples Example using (a, b) := a i b i C[0, 1] using (f, g) := 1 0 fg C n using (a, b) := a i b i, sesquilinear! l 2 := {(x i ) i N : < }, with (a, b) := R n xi 2 i=0 i=0 a i b i 9 / 36

Inner Product Space, Examples Example using (a, b) := a i b i C[0, 1] using (f, g) := 1 0 fg C n using (a, b) := a i b i, sesquilinear! l 2 := {(x i ) i N : < }, with (a, b) := R n xi 2 i=0 i=0 a i b i L 2 := {f measurable : f 2 < }, with (f, g) := f g 9 / 36

Bessel s Inequality 10 / 36

Bessel s Inequality Spaces like L 2 or l 2 have infinite dimensions, therefore the orthogonal system can also be infinite: e i, i = 1, 2,.... 10 / 36

Bessel s Inequality Spaces like L 2 or l 2 have infinite dimensions, therefore the orthogonal system can also be infinite: e i, i = 1, 2,.... Theorem (Bessel s inequality) f 2 (f, e i ) 2, i.e. the series ((f, e i )) i l 2 10 / 36

Bessel s Inequality Spaces like L 2 or l 2 have infinite dimensions, therefore the orthogonal system can also be infinite: e i, i = 1, 2,.... Theorem (Bessel s inequality) f 2 (f, e i ) 2, i.e. the series ((f, e i )) i l 2 0 (f n (f, e i )e i, f i=1 = f 2 2(f, = f 2 2 = f 2 i=1 n (f, e k )e k ) k=1 n n (f, e i )e i ) + ( (f, e i )e i, n (f, e i ) 2 + i,k i=1 n (f, e i ) 2 i=1 i=1 n (f, e k )e k ) k=1 (f, a i )(f, a k ) (e i, e k ) }{{} δ ik 10 / 36

L 2 [ π, π], Basis 11 / 36

L 2 [ π, π], Basis We know want to find an orthogonal basis for the L 2 [ π, π]. It will be based on trigonometric functions. 11 / 36

L 2 [ π, π], Basis We know want to find an orthogonal basis for the L 2 [ π, π]. It will be based on trigonometric functions. Theorem (orthogonality relations) for a, b N 1 π 1 π 1 π π π π π π π cos ax cos bx = sin ax sin bx = δ ab sin ax cos bx = 0 { 2 if a = b = 0 δ ab else 11 / 36

L 2 [ π, π], Basis We know want to find an orthogonal basis for the L 2 [ π, π]. It will be based on trigonometric functions. Theorem (orthogonality relations) for a, b N 1 π 1 π 1 π π π π π π π cos ax cos bx = sin ax sin bx = δ ab sin ax cos bx = 0 We search for the coefficients of { 2 if a = b = 0 δ ab else f (x) a 0 2 + k a k cos kx + k b k sin kx 11 / 36

L 2 [ π, π], Basis 12 / 36

L 2 [ π, π], Basis We search for the coefficients of f (x) a 0 2 + k a k cos kx + k b k sin kx 12 / 36

L 2 [ π, π], Basis We search for the coefficients of f (x) a 0 2 + k a k cos kx + k b k sin kx Theorem (Fourier Coefficients) for a, b N a k = 1 π b k = 1 π π π π π f (x) cos ax f (x) sin ax 12 / 36

Approximation of an Rectangle, I 13 / 36

Approximation of an Rectangle, I The simple rectangle function { 1, if π f (n) = 2 x π 2 0, else has the Fourier coefficients: n=1 13 / 36

Approximation of an Rectangle, I The simple rectangle function { 1, if π f (n) = 2 x π 2 0, else has the Fourier coefficients: n=2 13 / 36

Approximation of an Rectangle, I The simple rectangle function { 1, if π f (n) = 2 x π 2 0, else has the Fourier coefficients: n=3 13 / 36

Approximation of an Rectangle, I The simple rectangle function { 1, if π f (n) = 2 x π 2 0, else has the Fourier coefficients: n=4 13 / 36

Approximation of an Rectangle, I The simple rectangle function { 1, if π f (n) = 2 x π 2 0, else has the Fourier coefficients: for k 0 : a k = 1 π = sin kx kπ a 0 = 1, b k = 1 π π 2 π 2 π π π π f (x) cos kx = 1 π = 2 kπ sin k π 2 = f (x) sin kx = 0 π 2 π 2 cos kx { 0, if k is even k 1 2 kπ ( 1) 2, else n=5 13 / 36

Approximation of an Rectangle, I The simple rectangle function { 1, if π f (n) = 2 x π 2 0, else has the Fourier coefficients: for k 0 : a k = 1 π = sin kx kπ a 0 = 1, b k = 1 π π 2 π 2 π π π π f (x) cos kx = 1 π = 2 kπ sin k π 2 = f (x) sin kx = 0 π 2 π 2 cos kx { 0, if k is even k 1 2 kπ ( 1) 2, else n=10 13 / 36

Approximation of an Rectangle, I The simple rectangle function { 1, if π f (n) = 2 x π 2 0, else has the Fourier coefficients: for k 0 : a k = 1 π = sin kx kπ a 0 = 1, b k = 1 π π 2 π 2 π π π π f (x) cos kx = 1 π = 2 kπ sin k π 2 = f (x) sin kx = 0 π 2 π 2 cos kx { 0, if k is even k 1 2 kπ ( 1) 2, else n=20 13 / 36

Approximation of an Rectangle, II 14 / 36

Approximation of an Rectangle, II therefore the Fourier series for the rectangle function is f (x) = 1 2 + 2( 1) k 1 π k=1 cos(2k 1)x 2k 1 14 / 36

Approximation of an Rectangle, II therefore the Fourier series for the rectangle function is if we set x = 0 we get f (x) = 1 2 + 2( 1) k 1 π π 4 = k=1 k=1 cos(2k 1)x 2k 1 ( 1) k 1 2k 1 = 1 1 3 + 1 5 1 7... 14 / 36

Convergence of Fourier Series 15 / 36

Convergence of Fourier Series As seen with the rectangle function pointwise convergence cannot be expected everywhere (Gibbs phenomena), nevertheless 15 / 36

Convergence of Fourier Series As seen with the rectangle function pointwise convergence cannot be expected everywhere (Gibbs phenomena), nevertheless Theorem We denote by S n the Fourier series with n terms 15 / 36

Convergence of Fourier Series As seen with the rectangle function pointwise convergence cannot be expected everywhere (Gibbs phenomena), nevertheless Theorem We denote by S n the Fourier series with n terms L 2 norm f L 2 ; f S n = f S n 2 0 (Riesz-Fischer) 15 / 36

Convergence of Fourier Series As seen with the rectangle function pointwise convergence cannot be expected everywhere (Gibbs phenomena), nevertheless Theorem We denote by S n the Fourier series with n terms L 2 norm f L 2 ; f S n = f S n 2 0 (Riesz-Fischer) uniform f C 1 ; S n f uniformly (Dirichlet) 15 / 36

Convergence of Fourier Series As seen with the rectangle function pointwise convergence cannot be expected everywhere (Gibbs phenomena), nevertheless Theorem We denote by S n the Fourier series with n terms L 2 norm f L 2 ; f S n = f S n 2 0 (Riesz-Fischer) uniform f C 1 ; S n f uniformly (Dirichlet) pointwise f L 2 ; S n f pointwise a.e. (Carleson) 15 / 36

Convergence of Fourier Series As seen with the rectangle function pointwise convergence cannot be expected everywhere (Gibbs phenomena), nevertheless Theorem We denote by S n the Fourier series with n terms L 2 norm f L 2 ; f S n = f S n 2 0 (Riesz-Fischer) uniform f C 1 ; S n f uniformly (Dirichlet) pointwise f L 2 ; S n f pointwise a.e. (Carleson) 15 / 36

Convergence of Fourier Series As seen with the rectangle function pointwise convergence cannot be expected everywhere (Gibbs phenomena), nevertheless Theorem We denote by S n the Fourier series with n terms L 2 norm f L 2 ; f S n = f S n 2 0 (Riesz-Fischer) uniform f C 1 ; S n f uniformly (Dirichlet) pointwise f L 2 ; S n f pointwise a.e. (Carleson) with Riesz-Fischer we have Theorem (Parseval equality) f 2 = (f, e i ) 2, i.e. F : L 2 l 2 defined by f (f, e i ) i is isometric. 15 / 36

Complex Fourier Series 16 / 36

Complex Fourier Series using Eulers formula e ix = cos x + sin x 16 / 36

Complex Fourier Series using Eulers formula e ix = cos x + sin x we can rewrite the Fourier series f = with c 0 = a 0 2 n= c n = a n ib n 2 c n = a n + ib n 2 c n e inx for n > 0 for n > 0 16 / 36

Complex Fourier Series using Eulers formula e ix = cos x + sin x we can rewrite the Fourier series f = with respectively c 0 = a 0 2 n= c n = a n ib n 2 c n = a n + ib n 2 c n e inx for n > 0 for n > 0 c n = 1 π f (x)e inx 2π π 16 / 36

Complex Fourier Series Fourier Transform 17 / 36

Complex Fourier Series Fourier Transform we recall c k = 1 π f (x)e ikx, f = 2π π k= c k e ikx with a limiting process (extending the interval [ π, π] to [, ]) we get Definition (Fourier Transform) c(n) = 1 f (x)e inx dx, f (x) = c(n)e inx dn 2π n= 17 / 36

Fourier Transform 18 / 36

Fourier Transform Fourier transform for one and two variables (slightly changed notation): ˆf (k, s) = 1 2π ˆf (k) := 1 2π f (x)e ikx dx f (x, y)e i ( xy ) ( ) ks dx dy 18 / 36

Fourier Transform Fourier transform for one and two variables (slightly changed notation): ˆf (k, s) = 1 2π ˆf (k) := 1 2π f (x)e ikx dx f (x, y)e i ( xy ) ( ) ks dx dy The formulae for the inverse Fourier transform look similar, we have just to interchange f and ˆf and to cancel the " " from the exponent of the exponential function. 18 / 36

Fourier Transform, Basic Properties 19 / 36

Fourier Transform, Basic Properties Theorem linear λf + g λˆf + ĝ 19 / 36

Fourier Transform, Basic Properties Theorem linear λf + g λˆf + ĝ translation f (x + α) f (k)e ikα 19 / 36

Fourier Transform, Basic Properties Theorem linear λf + g λˆf + ĝ translation f (x + α) f (k)e ikα convolution f g ˆf ĝ 19 / 36

Fourier Transform, Basic Properties Theorem linear λf + g λˆf + ĝ translation f (x + α) f (k)e ikα convolution f g ˆf ĝ d differentiation n (dx) f (ik) n f (k) n 19 / 36

Fourier Transform, Basic Properties Theorem linear λf + g λˆf + ĝ translation f (x + α) f (k)e ikα convolution f g ˆf ĝ d differentiation n (dx) f (ik) n f (k) n eigenfunctions e ax2 1 2a e k2 /(4a) 19 / 36

Fourier Transform, Basic Properties Theorem linear λf + g λˆf + ĝ translation f (x + α) f (k)e ikα convolution f g ˆf ĝ d differentiation n (dx) f (ik) n f (k) n eigenfunctions e ax2 1 2a e k2 /(4a) isometry (f, g) = (ˆf, ĝ) 19 / 36

Discrete Fourier Transform (DFT) 20 / 36

Discrete Fourier Transform (DFT) The MATLAB implementation of the Fourier transform for one variable looks more like a complex Fourier series: X (k) := N j=1 x(j)e 2πi N (j 1)(k 1) 20 / 36

Discrete Fourier Transform (DFT) The MATLAB implementation of the Fourier transform for one variable looks more like a complex Fourier series: X (k) := N j=1 x(j)e 2πi N (j 1)(k 1) The first element of the X vector is the sum of all elements X (1) = N x(j) e 2πi N } (j 1)(1 1) {{} = j=1 =e 0 =1 N x(j) j=1 20 / 36

DFT of sin(k*x) in MATLAB To find the DFT of a sine wave in MATLAB, we have >> x=(0:127)/128*2*pi; >> fft(sin(x)) 0-64i 0... 0 64i >> fft(sin(5*x)) 0 0 0 0 0-64i 0... 0 64i 0 0 0 0 21 / 36

DFT of sin(k*x) in MATLAB To find the DFT of a sine wave in MATLAB, we have >> x=(0:127)/128*2*pi; >> fft(sin(x)) 0-64i 0... 0 64i >> fft(sin(5*x)) 0 0 0 0 0-64i 0... 0 64i 0 0 0 0 With the time difference τ between i and i + 1, the periodic time (time from 0 to N) is Nτ, therefore the frequency of the k th peak in the DFT is (k 1) f k = Nτ 21 / 36

DFT of sin(k*x) in MATLAB If we use sin(x) = eix e ix 2i for x = 2π N (j 1), j = 1,... N the DFT of sin(nx) is X (k) = = N j=1 j=1 x(j)e 2πi N (j 1)(k 1) N e n 2πi N (j 1) 2πi n e 2i = 1 N 2i j=1 = 1 N 1 2i j=0 N (j 1) e 2πi N (j 1)(n k+1) N 1 e 2πi N j(n k+1) j=0 e 2πi N (j 1)(k 1) N j=1 e 2πi N (j 1)( n k+1) e 2πi N j( n k+1) 22 / 36

DFT of sin(k*x) in MATLAB With the formula for the geometric series, we have N 1 (e 2πi N (n k+1) ) N 1 e 2πi N (n k+1)j = 0, if n k + 1 0 = e 2πi N (n k+1) 1 j=0 N, else, i.e. if k = n + 1 and N 1 j=0 e 2πi N ( n k+1)j = (e 2πi N ( n k+1) ) N 1 = 0, if N n k + 1 0 e 2πi N ( n k+1) 1 N, if k = N n + 1 E.g. for sin(7x) and N = 128, the DFT has X (8) = 64i, X (122) = 64i and all the other X (k) are zero. For cos(7x) we have X (8) = X (122) = 64 and all the other X (k) are zero. 23 / 36

Applications We present two applications 24 / 36

Applications We present two applications filtering of a noisy signal 24 / 36

Applications We present two applications filtering of a noisy signal determination of the main frequencies contained in a signal 24 / 36

Applications We present two applications filtering of a noisy signal determination of the main frequencies contained in a signal 24 / 36

Applications We present two applications filtering of a noisy signal determination of the main frequencies contained in a signal the examples were implemented in MATLAB 24 / 36

Low Pass Filtering - Noise Suppression We start with a mixture of two sinus signals, of different frequency and amplitude: 25 / 36

Low Pass Filtering - Noise Suppression We start with a mixture of two sinus signals, of different frequency and amplitude: >> x=(0:127)/128*4*pi; >> s = sin(2*x)+0.8*sin(15*x); >> plot(x,s) 25 / 36

Low Pass Filtering - Noise Suppression Then we compute the Fourier Transform 26 / 36

Low Pass Filtering - Noise Suppression Then we compute the Fourier Transform >> fs=fft(s); >> plot(abs(s)) 26 / 36

Low Pass Filtering - Noise Suppression Then we compute the Fourier Transform >> fs=fft(s); >> plot(abs(s)) The outer peaks are the low frequencies, the inner ones are the noise. 26 / 36

Low Pass Filtering - Noise Suppression Now we delete the peaks in the Fourier transform that were caused by noise. Then we apply the inverse Fourier transform and plot both the original together with the cleaned signal. 27 / 36

Low Pass Filtering - Noise Suppression Now we delete the peaks in the Fourier transform that were caused by noise. Then we apply the inverse Fourier transform and plot both the original together with the cleaned signal. >> fs_clean=fs; >> fs_clean[20:110]=0; >> s_clean=real(ifft(fs_clean)); >> plot(x,s,x,s_clean) 27 / 36

Heart- and Breathing Frequency using the DFT 28 / 36

Heart- and Breathing Frequency using the DFT During heart surgery (TECAB) a video sequence of the pericardium was made with an endoscope. 28 / 36

Heart- and Breathing Frequency using the DFT During heart surgery (TECAB) a video sequence of the pericardium was made with an endoscope. Our idea is 28 / 36

Heart- and Breathing Frequency using the DFT During heart surgery (TECAB) a video sequence of the pericardium was made with an endoscope. Our idea is 1. compare the first frame with the second, third, fourth, etc using an image comparision measure 28 / 36

Heart- and Breathing Frequency using the DFT During heart surgery (TECAB) a video sequence of the pericardium was made with an endoscope. Our idea is 1. compare the first frame with the second, third, fourth, etc using an image comparision measure 2. in-phase image frames are similar find prominent frequencies using the Fourier transform. 28 / 36

Loading the Video Frames We load 750 frames of size 768x576 of the video sequence: 29 / 36

Loading the Video Frames We load 750 frames of size 768x576 of the video sequence: >> frames = zeros(576,768,750); >> for k=1:750 filename =./slices/b- ; fn = sprintf( %s%05d.jpg,filename, k); im=double(imread(fn)); frames(:,:,k)= 0.3*im(:,:,1)+0.59*im(:,:,2)+0.11*im(:,:,3); end 29 / 36

Loading the Video Frames We load 750 frames of size 768x576 of the video sequence: >> frames = zeros(576,768,750); >> for k=1:750 filename =./slices/b- ; fn = sprintf( %s%05d.jpg,filename, k); im=double(imread(fn)); frames(:,:,k)= 0.3*im(:,:,1)+0.59*im(:,:,2)+0.11*im(:,:,3); end because of limited memory we converted the colour images to greyscale (luminance) via frames(:,:,k)=0.3*... (768*576*750 doubles are about 2.4 GB on a 64 bit machine) 29 / 36

Frame Comparison Function To compare the frames we use summed squared differences: 30 / 36

Frame Comparison Function To compare the frames we use summed squared differences: function res = ssd( i1, i2 ) res=sum(sum((i1-i2).^2)); 30 / 36

Frame Comparison Function To compare the frames we use summed squared differences: function res = ssd( i1, i2 ) res=sum(sum((i1-i2).^2)); and compute the difference from frame one to all the others: 30 / 36

Frame Comparison Function To compare the frames we use summed squared differences: function res = ssd( i1, i2 ) res=sum(sum((i1-i2).^2)); and compute the difference from frame one to all the others: >> ssdall=[]; >> for k=1:750; ssdall =[ssdall ssd(frames(:,:,1),frames(:,:,k))]; end 30 / 36

Frame Comparison Function 31 / 36

Frame Comparison Function The difference of frame one to the first frames is artificially small, we use only frames 13-750 31 / 36

Frame Comparison Function The difference of frame one to the first frames is artificially small, we use only frames 13-750 5.5 6 x 108 >> ssdsmall=ssdall(13:750); >> plot(sdssmall) ssd(slice 1, slice k ) 5 4.5 4 3.5 3 0 200 400 600 800 slice number 31 / 36

Derive the DFT 32 / 36

Derive the DFT The first component of the FFT is the sum of all elements, to avoid this we subtract the mean value. 32 / 36

Derive the DFT The first component of the FFT is the sum of all elements, to avoid this we subtract the mean value. We have 738 frames and 25 frames per second, τ = 1/25 = 0.04, the frequency of the k-th peak is f k = k 1 Nτ = k 1 29.52 Hz 2 (k 1) beats per minute 32 / 36

Derive the DFT The first component of the FFT is the sum of all elements, to avoid this we subtract the mean value. We have 738 frames and 25 frames per second, τ = 1/25 = 0.04, the frequency of the k-th peak is f k = k 1 Nτ = k 1 29.52 Hz 2 (k 1) beats per minute 8 x 109 >> ssdsmall=ssdall(13:750); >> fssd=fft(ssdsmall-mean(ssdsmall)); >> x=(0:40)./((738*0.04)/60); >> plot(x,abs(fssd(1:41))) 6 4 2 0 0 20 40 60 80 events per minute 32 / 36

Comparison with ECG 33 / 36

Comparison with ECG The first peak of the FFT is the respiration, the second the heart motion 33 / 36

Comparison with ECG The first peak of the FFT is the respiration, the second the heart motion The peaks are at k = 7, which is 12 bpm and at k = 27, which is 52 bpm. 8 x 109 6 4 2 0 0 20 40 60 80 events per minute 33 / 36

Sunspots Period 34 / 36

Sunspots Period Unfortunately not even the sun is free from ugly little spots. 34 / 36

Sunspots Period Unfortunately not even the sun is free from ugly little spots. A regular variation in the number of sunspots was described by Samuel Schwabe in 1843. 34 / 36

Sunspots Period Unfortunately not even the sun is free from ugly little spots. A regular variation in the number of sunspots was described by Samuel Schwabe in 1843. 34 / 36

Sunspots Period Unfortunately not even the sun is free from ugly little spots. A regular variation in the number of sunspots was described by Samuel Schwabe in 1843. Rudolf Wolf collected sunspot activity data and calculated a period of 11.1 years. To compare the data he defined the Wolf sche Relativzahl, also called sunspot number. 34 / 36

Sunspot Number 35 / 36

Sunspot Number The sunspot number is calculated by first counting the number of sunspot groups g and then the number of individual sunspots s. 35 / 36

Sunspot Number The sunspot number is calculated by first counting the number of sunspot groups g and then the number of individual sunspots s. Then SSN = 10 g + s 35 / 36

Sunspot Number 300 The sunspot number is calculated by first counting the number of sunspot groups g and then the number of individual sunspots s. Then SSN = 10 g + s SSN 200 100 0 0 1000 2000 3000 month 35 / 36

Sunspot Number The sunspot number is calculated by first counting the number of sunspot groups g and then the number of individual sunspots s. Then SSN = 10 g + s SSN 300 200 100 0 0 1000 2000 3000 month Since most sunspot groups have, on average, about ten spots, this formula for counting sunspots gives reliable numbers even when the observing conditions are less than ideal and small spots are hard to see. 35 / 36

Sunspot Number The sunspot number is calculated by first counting the number of sunspot groups g and then the number of individual sunspots s. Then SSN = 10 g + s SSN 300 200 100 0 0 1000 2000 3000 month Since most sunspot groups have, on average, about ten spots, this formula for counting sunspots gives reliable numbers even when the observing conditions are less than ideal and small spots are hard to see. Source solarscience.msfc.nasa.gov/sunspotcycle.shtml 35 / 36

Sunspot Cycle Length 36 / 36

Sunspot Cycle Length >> fs=abs(fft(ssnn)); >> plot(fs(1:100)) >> [C I]=max(fs(1:30))... I = 25 >> length(ssn) 3181 36 / 36

Sunspot Cycle Length >> fs=abs(fft(ssnn)); >> plot(fs(1:100)) >> [C I]=max(fs(1:30))... I = 25 >> length(ssn) 5 x 104 0 3181 0 20 40 60 80 100 4 3 2 1 36 / 36

Sunspot Cycle Length >> fs=abs(fft(ssnn)); >> plot(fs(1:100)) >> [C I]=max(fs(1:30))... I = 25 >> length(ssn) 0 3181 0 20 40 60 80 100 The maximum is at k = 25, 5 x 104 4 3 2 1 36 / 36

Sunspot Cycle Length >> fs=abs(fft(ssnn)); >> plot(fs(1:100)) >> [C I]=max(fs(1:30))... I = 25 >> length(ssn) 5 x 104 0 3181 0 20 40 60 80 100 The maximum is at k = 25, remember f k = k 1 Nτ, τ = 1/12, years are the time unit 4 3 2 1 36 / 36

Sunspot Cycle Length >> fs=abs(fft(ssnn)); >> plot(fs(1:100)) >> [C I]=max(fs(1:30))... I = 25 >> length(ssn) 5 x 104 0 3181 0 20 40 60 80 100 The maximum is at k = 25, remember f k = k 1 Nτ, τ = 1/12, years are the time unit >> f=(25-1)/(3181*1/12) f = 0.0905 >> 1/f 11.0451 4 3 2 1 36 / 36