The continuous and discrete Fourier transforms



Similar documents
Convolution, Correlation, & Fourier Transforms. James R. Graham 10/25/2005

The Fourier Analysis Tool in Microsoft Excel

Aliasing, Image Sampling and Reconstruction

Correlation and Convolution Class Notes for CMSC 426, Fall 2005 David Jacobs

Frequency Response of FIR Filters

SGN-1158 Introduction to Signal Processing Test. Solutions

SIGNAL PROCESSING & SIMULATION NEWSLETTER

Fourier Analysis. u m, a n u n = am um, u m

FFT Algorithms. Chapter 6. Contents 6.1

TOPIC 4: DERIVATIVES

Probability and Random Variables. Generation of random variables (r.v.)

Homework # 3 Solutions

ANALYZER BASICS WHAT IS AN FFT SPECTRUM ANALYZER? 2-1

The Heat Equation. Lectures INF2320 p. 1/88

Computational Foundations of Cognitive Science

Short-time FFT, Multi-taper analysis & Filtering in SPM12

Differentiation and Integration

Design of FIR Filters

Introduction to Complex Numbers in Physics/Engineering

A Little Set Theory (Never Hurt Anybody)

Final Year Project Progress Report. Frequency-Domain Adaptive Filtering. Myles Friel. Supervisor: Dr.Edward Jones

2.2 Magic with complex exponentials

5.4 The Heat Equation and Convection-Diffusion

TCOM 370 NOTES 99-4 BANDWIDTH, FREQUENCY RESPONSE, AND CAPACITY OF COMMUNICATION LINKS

Math 120 Final Exam Practice Problems, Form: A

South Carolina College- and Career-Ready (SCCCR) Pre-Calculus

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1.

Appendix D Digital Modulation and GMSK

Analog and Digital Signals, Time and Frequency Representation of Signals

Lecture 8 ELE 301: Signals and Systems

Practice with Proofs

Oscillations. Vern Lindberg. June 10, 2010

Computer Networks and Internets, 5e Chapter 6 Information Sources and Signals. Introduction

Scalar Valued Functions of Several Variables; the Gradient Vector

An Introduction to Partial Differential Equations

Cartesian Products and Relations

Lecture 7 ELE 301: Signals and Systems

MATH 4330/5330, Fourier Analysis Section 11, The Discrete Fourier Transform

CONVOLUTION Digital Signal Processing

Operation Count; Numerical Linear Algebra

1.4 Fast Fourier Transform (FFT) Algorithm

Review of Fourier series formulas. Representation of nonperiodic functions. ECE 3640 Lecture 5 Fourier Transforms and their properties

S. Boyd EE102. Lecture 1 Signals. notation and meaning. common signals. size of a signal. qualitative properties of signals.

Series FOURIER SERIES. Graham S McDonald. A self-contained Tutorial Module for learning the technique of Fourier series analysis

Analysis/resynthesis with the short time Fourier transform

Implementation of Digital Signal Processing: Some Background on GFSK Modulation

Wavelet analysis. Wavelet requirements. Example signals. Stationary signal 2 Hz + 10 Hz + 20Hz. Zero mean, oscillatory (wave) Fast decay (let)

Introduction to Complex Fourier Series

The Convolution Operation

Vector and Matrix Norms

Undergraduate Notes in Mathematics. Arkansas Tech University Department of Mathematics

How To Understand The Nyquist Sampling Theorem

How To Understand The Discrete Fourier Transform

ENCOURAGING THE INTEGRATION OF COMPLEX NUMBERS IN UNDERGRADUATE ORDINARY DIFFERENTIAL EQUATIONS

Answer Key for California State Standards: Algebra I

Sampling Theorem Notes. Recall: That a time sampled signal is like taking a snap shot or picture of signal periodically.

1 if 1 x 0 1 if 0 x 1

Spectrum Level and Band Level

LS.6 Solution Matrices

Chapter 8 - Power Density Spectrum

Math 4310 Handout - Quotient Vector Spaces

5 Signal Design for Bandlimited Channels

Algebra 2 Chapter 1 Vocabulary. identity - A statement that equates two equivalent expressions.

(Refer Slide Time: 01:11-01:27)

Review of Vector Analysis in Cartesian Coordinates

BANACH AND HILBERT SPACE REVIEW

Vector Spaces; the Space R n

ANALYTICAL METHODS FOR ENGINEERS

Method of Green s Functions

9 Fourier Transform Properties

Unified Lecture # 4 Vectors

Continued Fractions and the Euclidean Algorithm

Scientific Programming

14.1. Basic Concepts of Integration. Introduction. Prerequisites. Learning Outcomes. Learning Style

Quotient Rings and Field Extensions

Application of Fourier Transform to PDE (I) Fourier Sine Transform (application to PDEs defined on a semi-infinite domain)

The Effective Number of Bits (ENOB) of my R&S Digital Oscilloscope Technical Paper

2.6 The driven oscillator

DIODE CIRCUITS LABORATORY. Fig. 8.1a Fig 8.1b

Auto-Tuning Using Fourier Coefficients

List the elements of the given set that are natural numbers, integers, rational numbers, and irrational numbers. (Enter your answers as commaseparated

Positive Feedback and Oscillators

Mutual Inductance and Transformers F3 3. r L = ω o

Metric Spaces. Chapter Metrics

Sampling and Interpolation. Yao Wang Polytechnic University, Brooklyn, NY11201

Algebra I Notes Relations and Functions Unit 03a

BASIC ELECTRONICS AC CIRCUIT ANALYSIS. December 2011

8 Primes and Modular Arithmetic

6.4 Normal Distribution

Examples of Functions

Lectures 5-6: Taylor Series

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

DIFFERENTIABILITY OF COMPLEX FUNCTIONS. Contents

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS

Convolution. The Delta Function and Impulse Response

PRE-CALCULUS GRADE 12

LABORATORY 10 TIME AVERAGES, RMS VALUES AND THE BRIDGE RECTIFIER. Bridge Rectifier

Notes on Determinant

2.161 Signal Processing: Continuous and Discrete Fall 2008

Transcription:

FYSA21 Mathematical Tools in Science The continuous and discrete Fourier transforms Lennart Lindegren Lund Observatory (Department of Astronomy, Lund University) 1 The continuous Fourier transform 1.1 Definitions Provided that the integrals exist, the following holds: ˆf(ξ) = f(x) = 1 2π f(x) e ixξ dx ˆf(ξ) e ixξ dξ (1) The top equation defines the Fourier transform (FT) of the function f, the bottom equation defines the inverse Fourier transform of ˆf. f and ˆf are in general complex functions (see Sect. 1.3). The Fourier transform is sometimes denoted by the operator F and its inverse by F 1, so that: ˆf = F[f], f = F 1 [ ˆf] (2) It should be noted that the definitions in Eq. (1) are not the only ones found in the literature. Examples of other conventions are given below. Example 1: An alternative definition is X(ω) = x(t) = 1 + x(t) e iωt dt 2π 1 + X(ω) e iωt dω 2π (3) Note the placement of the minus sign in the inverse transform, the use of the normalizing factor (2π) 1/2 on both integrals, and the notation using lower and upper case letters for the function and its transform. Example 2: Another common variant is H(f) = h(t) = h(t) e i2πft dt H(f) e i2πft df (4) where the need for a normalization factor is eliminated by the substitution ω = 2πf. 1

The different definitions above are related by trivial substitution or scaling of the variables. It is however important to know which definition is used in a particular application. The special case of x = 0 (or t = 0) and ξ = 0 (or ω = 0) are often useful test cases ; e.g., Eq. (1) gives: ˆf(0) = f(x) dx, f(0) = 1 2π 1.2 Interpretation of the variables. Units ˆf(ξ) dξ (5) The variable x in Eq. (1) often represents length (i.e., a spatial coordinate) eller time. The variable ξ should then be interpreted as wave number (spatial frequency) or angular frequency; thus ξ = 2π/P, where P is the period in length or time. If x is measured in [m], then ξ will be expressed in [rad m 1 ]. If x is measured in [s], then ξ will be expressed in [rad s 1 ]. When time is involved, the variables are usually denoted t and ω rather than x and ξ. In Example 2, f stands for the ordinary frequency expressed in periods per unit of t; e.g., if t is length in [m], then f is spatial frequency in [per m 1 ] or [m 1 ]. If t is time in [s], then f is temporal frequency in [per s 1 ] or [Hz]. 1.3 The FT of a real function The definitions in Sect. 1.1 are valid for complex functions f and ˆf. When f(x) represents a measured quantity it is usually real, in which case ˆf( ξ) = ˆf (ξ) (real f) (6) ˆf is in general still complex, but its real part is even and its imaginary part odd. If f(x) is real and even [so that f( x) = f(x)], then ˆf is also real and even. Figures 1 4 show some Fourier transform pairs for real, even functions. A general property of Fourier transform pairs is that a wide function has a narrow FT, and vice versa. This localization property implies that we cannot arbitrarily concentrate both the function and its Fourier transform. This is illustrated in Figs. 1 4: In Fig. 1 the boxcar function of width 2a is transformed into a sinc-function 1 of width π/a (as measured from the centre to the first zero). In Fig. 2 a constant (being infinitely wide) is transformed into the (infinitely narrow) delta function. 2 In Fig. 3 a cosine function with period 2π/a is transformed into a pair of delta functions separated by 2a. In Fig. 4 a gaussian function of standard deviation a is transformed into another gaussian with standard deviation 1/a. Fig. 2 can be seen as the limiting case of Fig. 1 or 4 when a. 1 The sinc function is sinc x = sin x/x with sinc 0 = 1. 2 Dirac s delta function δ(x) is = 0 everywhere except at x = 0, where it is infinite. Its area (inegral) is = 1. In the diagrams the delta function is shown as an arrow pointing upwards. 2

Figure 1. The boxcar function of width 2a, f(x) = (1 if x < a, else 0), and its Fourier transform F (ξ) = 2(sin aξ)/ξ = 2a sinc(aξ). [F is the same as ˆf in Eq. (1).] Figure 2. The constant function f(x) = 1, and its Fourier transform F (ξ) = 2πδ(ξ). Figure 3. f(x) = cos(ax) for a = 2, and F (ξ) = πδ(ξ a) + πδ(ξ + a). Figure 4. f(x) = exp( x 2 /2a 2 ) for a = 1.5, and F (ξ) = (2π) 1/2 a exp( a 2 ξ 2 /2). 3

2 The discrete Fourier transform 2.1 Definitions Given N values u 0,..., u N 1, the following holds: û k = N 1 j=0 u j = 1 N u j e i2πjk/n N 1 k=0 û k e i2πjk/n The first equation gives the discrete Fourier transform (DFT) of the sequence {u j }; the second gives the inverse discrete Fourier transform of the sequence {û k }. u j are û k är in general complex (cf. Sect. 1.3). Note that although the formulae in Eq. (7) define the direct and inverse DTFs, they are almost never used to calculate them. The reason is that they are computationally inefficient for large N. (The number of arithmetic operations grows as N 2.) Instead, an elegant algorithm called the Fast Fourier Transform (FFT) is used. This is really just a clever way of re-arranging the multiplications and sums in (7), using the properties of the exponential function, to reduce the total number of arithmetic operations. (With the FFT, the number of operations grows as N ln N.) Mathematically, however, the result of the FFT is identical to Eq. (7). As was the case for the continuous Fourier transform, the DFT comes in several different variants depending on the placement of the normalization factor 1/N (which can be placed either in the direct or the inverse transform) and the sign of the imaginary unit in the exponentials. In other words, one has to look out for which conventions are used in a particular application. In the project Signal analysis in astronomy the convention is that the factor 1/N is included in the direct transform. Another complication is that vectors and matrices in some programming languages (including MATLAB) start at index 1 instead of 0 as in Eq. (7). For example, the MATLAB functions U = fft(u) and u = ifft(u) implement the formulae N U(k) = u(j) e i2π(j 1)(k 1)/N, k = 1... N j=1 (8) u(j) = 1 N U(k) e i2π(j 1)(k 1)/N, j = 1... N N k=1 (using the FFT). These are equivalent to Eq. (7) using the substitution u(j) = u j 1 (j = 1... N), U(k) = û k 1 (k = 1... N) (9) (7) 2.2 Interpretation of the variables. Units In physical applications, the values in the sequence u 0, u 1,..., u N 1 usually represent some measurable quantity (temperature, electrical voltage, intensity of light) in a 4

number of equidistant points along some spatial coordinate or time. There is then always a corresponding sequence of spatial or time coordinates x j = x start + j x, j = 0... N 1 (10) such that u j is the value of the physical quantity at point x j. The sequence {u j } is a sampling of the physical quantity in N points with sampling interval x. The starting point of the sampling, x start, is often of little interest; however, it is always important to know x and N. What is the interpretation of û k? These are complex values that specify the amplitude ( N) and phase of the set of N Fourier components, that jointly exactly represent the original sequence. The frequencies of the Fourier components form are equidistant, f k = k f, k = 0... N 1 (11) with f = 1/(N x). The unit for f is the inverse of the unit for x. If x is in [m], then f is in [per m 1 ]; if x is in [s], then f is in [Hz]. Note that ordinary frequencies are used here no angular frequency or wave number since the definition of the DFT uses 2πf in the exponentials. When using MATLAB it is important to remember that the transformed value U(k) corresponds to frequency (k 1) f, since the index of the array starts at 1. 2.3 Effects of the sampling The DFT can be regarded as an approximation of the continuous FT, which it approaches (after suitable normalization) when N goes to infinity and/or x goes to zero. In practice, N and x are always finite, which causes some undesirable effects. Two important effects of the sampling are: Aliasing: Suppose that we sample the continuous function sin(2πf x) (of frequency f) in the points x j = j x, i.e., using the sampling frequency f s = 1/ x. It is then easy to see that the sampled points will be exactly the same if we replace f by f + nf s in the sine function, where n is an integer. There is consequently an infinitude of sine functions with different frequencies (aliases) that all look exactly the same after sampling. For a real function, there are even more aliases, since the Fourier components at nf s + f and nf s f are complex conjugate and therefore have the same amplitude. In particular, the components at f and f s f are complex conjugate. This becomes a problem if the sampled signal contains real components with f > f s /2 f Ny (the Nyquist frequency), since they will then (falsely) appear also at f s f < f Ny. Therefore, if the continuous signal contains components up to f max, it is necessary to choose x < 1/(2f max ) in order to avoid aliasing. In other words, the minimum sampling frequency is 2f max. Finite frequency resolution: The DFT of a sequence of length N x provides a decomposition into Fourier components that are separated by f = 1/(N x). This means that if the signal contains components whose frequencies are separated by less than f, they cannot be distinguished in the DFT. 5

For example, if we know that a continuous signal contains two components with frequencies f A and f B (where f A < f B ), we can derive the minimum requirements in terms of x and N to enable unambiguous determination of the two components. First, the maximum sampling interval is given by twice the maximum frequency in the signal, i.e., f s > 2f B or x < 1/(2f B ). Secondly, the minimum length of the sequence is given by the inverse of the required frequency resolution, or N x > 1/(f B f A ). 3 Convolution and filtering 3.1 Definition of convolution The convolution 3 of two continuous functions f(x) and g(x) is defined as h(x) = which is often written symbolically f(x )g(x x ) dx (12) h = f g (13) The convolution operator is commutative, g f = f g. A simple example will make the meaning of Eq. (12) a little clearer. Suppose g(x) is the boxcar function of width 2a and area 1, so that g(x) = 1 2a if x < a 0 otherwise Then h(x) = f(x )g(x x ) dx = 1 x+a f(x ) dx (15) 2a x a which is a so-called running mean of f(x) (that is, h(x) is the mean value of f(x ) for x [x a, x + a]). For other functions g(x) one can regard the convolution f g as a weighted running mean of f(x). 4 The convolution operator is graphically illustrated in Fig. 5. Convolving the arbitrary function f(x) with Dirac s delta leaves the function unchanged: f(x) δ(x) = δ(x) f(x) = δ(x )f(x x ) dx = 0+ 0 (14) δ(x )f(x x ) dx = f(x) (16) Convolution is in practice the same as filtering: the convolution suppresses or enhances different Fourier components in the signal or image. A running mean suppresses high frequencies and therefore acts as a low-pass filter (although there exist 3 In Swedish: faltning, konvolvering or konvolution. 4 Strictly speaking one can only talk about the convolution as a running mean when g(x) has unit area, as in the example above. Convolution is however defined for more general functions. 6

Figure 5. Step-bystep illustration of the convolution h = f g in Eq. (12). The functions g and f are shown in (a) and (d), and their convolution h in (f). Note that the convolution can be thought of as a mirrored version of g gliding across f. The same result is obtained if a mirrored version of f glides across g. 7

more efficient filters for this). Convolution (or filtering) is useful for describing how a signal (f, for example an electric or acoustic signal, or an image) is affected by a linear system (e.g., electrical filter, resonance cavity, optics). The result ( output signal h) is the convolution of the input signal f with the impulse response function g. The latter gets its name from the system s response to a single short impulse (mathematically: f(x) = δ(x)), which according to Eq. (16) gives the output signal h = δ g = g. For discrete functions (sequences or time series) {u j }, {v j } the convolution w = u v is defined in the corresponding manner by means of the sum w j = k u k v j k (17) In principle the sum extends over all k for which v j k 0. But since a finite sequence has a limited range of index values, e.g. 0... N 1, the sum is usually defined over this range. j k should then be interpreted modulo N. This is equivalent to assuming that the sequence is periodically extended to the left and right (with period N). 3.2 The convolution theorem A central theorem in signal processing is the convolution theorem h = f g ĥ = ˆf.ĝ (18) which is valid for both continuous and discrete functions. Convolution in the spatial or time domain (x) is therefore equivalent to a multiplication in the corresponding frequency domain (ξ). The converse is also true: h = f.g ĥ = ˆf ĝ (19) Using the convolution theorem, it is possible to compute the discrete convolution w = u v much more efficiently (for large N) than by direct application of Eq. (17). Given the sequences {u j } and {v j } (both of length N) the recipe is: 1. Calculate the discrete Fourier transforms {û k } and {ˆv k } using the FFT algorithm (note that {û k } and {ˆv k } are complex, even if {u j } and {v j } are not) 2. Calculate ŵ k = û kˆv k for k = 0... N 1 3. Calculate the inverse DFT of {ŵ k }, which gives {w j } = {u j } {v j }. It may seem surprising that Fourier transforming forth and back is more efficient than a direct evaluation of the simple expression in Eq. (17). The reason is that the direct evaluation of Eq. (17) requires of the order of N 2 multiplications and additions, while each DFT in Step 1 and 3 above requires only of the order of N ln N operations (using the FFT; see Sect. 2.1) and Step 2 only 6N operations. Thus, for sufficiently large N the above procedure will always be more efficient. /LL 080822 8