Page updated: March 19, 2021
Author: Curtis Mobley
View PDF

Fourier Transforms

The representation of sea surfaces as sums of sinusoids suggests further analysis using Fourier transforms, which will be a fundamental mathematical tool for our subsequent study of sea surfaces. There are many texts on Fourier transforms. Bracewell (1986) is a standard reference, and excellent sets of lecture notes and videos of lectures can be found on the web. The results needed for the subsequent discussions will therefore be stated without proof.

Continuous Fourier Transforms

Given a real function z(x) of a continuous variable x, the Fourier transform (ν) of z(x) is defined as

(ν) {z(x)}z(x)ei2πνxdx. (1)

The inverse Fourier transform is given by

z(x) 1{(ν)}(ν)e+i2πνxdν. (2)

It can be shown that if we insert the (ν) integral of Eq. (1) into Eq. (2), we recover z(x). (This is known as Fourier’s integral theorem, the proof of which is not trivial.) Equations (1) and (2) are termed a Fourier transform pair.

Understanding the units of a Fourier transform is important. In our case, z(x) is sea surface elevation, and both z and x have units of meters. Equation (1) shows that (ν) thus has units of m2. The variance of z also has units of m2, which gives the first hint at a profound connection between the variance of a physical quantity and its Fourier transform. The units of m2 in the Fourier transform can be rewritten as m/(1/m), which is units of z divided by units of spatial frequency ν. Indeed, the transform (ν) can be interpreted as showing ”how much of z there is per unit frequency interval.” The inverse transform then has units of (z over frequency) times frequency, which returns the original units of z.

A Fourier transform is a spectral density function. The integral of a spectral density function over a given frequency interval gives the variance in the physical quantity contributed by the frequencies in the integration interval. Density functions are rather peculiar mathematical creatures compared to point functions, which simply give the value of something at a given value of the independent variable (e.g. the temperature at location x and time t). The blackbody radiation function is another example of a spectral density function. The blackbody function shows how much energy is emitted (at a given temperature) per unit frequency interval of the emitted electromagnetic radiation. The blackbody function is discussed on the page A Common Misconception. If you are not familiar with the distinction between point and density functions, especially regarding how to change variables in density functions, you should take a look at the page on blackbody spectra before continuing with the present discussion.

The Fourier transform definitions above with the 2π in the exponents are those of the “Stanford school” of Bracewell (1986) and Goodman (1996). You will see others in the literature. For example, if we use k = 2πν as the frequency variable, then Eqs. (1) and (2) become

(k) {z(x)}z(x)eikxdx (3)


z(x) 1{(k)} 1 2π(k)e+ikxdk. (4)

This reappearance of the 2π in the second equation is required so that the inverse transform of the transform gets you back to where you started. In the e±ikx version, some people put the 12π in front of the other integral, and some put a 12π in front of each integral. Some authors, e.g. Press et al. (1992), put the + i in Eq. (1) and the i in Eq. (2). The choice of which sign to use on the i and where to put the 2π is almost a religion—most people stay with what they first learned, are convinced of the superiority of their definition, and are willing to die rather than change. Fortunately, it doesn’t matter which definitions you use, so long as you are consistent in how the transform pair is defined so that you get back to where you started if you inverse transform a transform, or vice versa.

In our work, z(x) is the sea surface elevation, which is a real number. However, even though z(x) is real, (ν) (or (k)) is complex. Expanding the complex exponential in Eq. (1) as the sum of a cosine and a sine, it is easy to see that (ν) = (ν). Such functions are called Hermitian. A real function has a Hermitian Fourier transform. Conversely, if a function is Hermitian, it has a real inverse Fourier transform. The Hermitian property will be an important constraint on the next pages when we wish to generate random realizations of a sea surface by computing the inverse Fourier transform of a complex function: we will have to conjure up a Hermitian function so that we end up with a real sea surface.

Discrete Fourier Transforms

Now suppose that we have sampled the sea surface z(x) at a set of N evenly spaced points xr,r = 0, 1,...,N 1, in a region of size L; xr = rΔx = rLN . We want to describe this sampled sea surface z(xr) as a sum of sinusoids. In general, these N values can be represented as a sum of a constant term, N2 cosine terms, and N2 1 sine terms (recall that there is no two-point sine term):

z(xr) = a0 2 + u=1N2 a u cos(kuxr) + bu sin(kuxr) , (5)

with bN2 0. Note that the sum runs from the fundamental frequency (u = 1,k1 = 2πL) through the Nyquist frequency (u = N2,kN2 = 2π(2Δx)), with only a cosine term for the two-point wave. This sum is equivalent to

z(xr) = u=N2+1N2c ueikuxr , (6)

which also contains a total of N independent real and imaginary parts of the cn coefficients. (Recall from Eq. (5) of the previous page that ck = ck, so these coefficients are not independent for + k and k pairs.) These equations are the discrete-variable forms of Eqs. (6) and (7) of the previous page.

Comment on notation: It is common to use the letters i,j,k for dummy summation indices. However, we’ve already used i for 1 and k for angular wavenumber, so the preceding equations would be hopelessly confusing if we reused i and k for summation indices. We will therefore use r and s for indices on spatial variables, e.g., (xr,ys), and u and v for indices on frequency variables, e.g., ku or νv. n and m also will be used as needed for dummy indices.

We now have a finite number N of discrete samples z(xr) of the sea surface, so we need a discrete form of the Fourier transform. The discrete Fourier transform (DFT) of z(xr) is defined as

(νu) 𝒟{z(xr)} 1 N r=0N1z(x r)ei2πνuxr .

for u = 0, 1,....,N 1. Recalling that νu = uL = u(NΔx) and xr = rΔx = rLN gives νuxr = ruN. It is also common to write z(xr) = z(r) and (νu) = (u), in which case the previous equation becomes

(u) 𝒟{z(r)} 1 N r=0N1z(r)ei2πruN. (7)

The corresponding inverse discrete Fourier transform is given by

z(r) 𝒟1{(u)} u=0N1(u)e+i2πruN. (8)

It was emphasized above that the continuous function (ν) defined by the continuous Fourier transform (1) is a density function with units of z(x) per spatial frequency interval, e.g., m/(1/m) if z is sea surface height in meters. However, the discrete function (u) defined by the discrete Fourier transform (7) has the same units as z(r). The discrete Fourier transform is a point function that shows how much of z(r) is contained in a finite frequency interval Δν = 1L centered at frequency νu = uL. Discrete Fourier transforms convert point functions z(r) to point functions (u).

The and 𝒟 notations will be used to distinguish continuous vs. discrete Fourier transforms. As just seen, the continuous and discrete transforms are different mathematical constructs with different units and interpretations; they must not be confused. Likewise, if necessary, a subscript can be appended to show the frequency variable, e.g., ν{z(x)} as in Eq. (1) or k{z(x)} as in Eq. (3). As always, there are competing definitions. Equations (7) and (8) are used in Bracewell and the IDL computer language. Numerical Recipes interchanges the i and i. Matlab puts the 1N factor on the inverse transform. Also, Matlab does not support array indices of 0, so the summation indices are shifted from 0 to N 1 to 1 to N, with a corresponding shift from ru to (r 1)(u 1) in the exponentials. The devil is in the details, and details like where to put the 1N factor and differences in array indexing in different computer languages can cause great misery when it comes time to actually write computer programs or to compare results computed by different canned subroutines.

The sums in the last two equations require computing complex exponentials (i.e., sines and cosines), multiplying by the corresponding values of z(r) or (u) and adding up the results. These equations can be evaluated for any value of N. The number of computations required to do this is of order N2. The computation time thus increases very rapidly for large N.

However, a classic paper by Cooley and Tukey (1965) showed how these sums can be computed in order N log 2N computations, if N is a power of 2. Their technique is now called the Fast Fourier Transform or FFT. The difference in computer time becomes enormous for large N. For example, if N = 212 = 4096, then N log 2N = 4096 × 12, and the difference in computation time is a factor of N2(N log 2N) 341. Thus in the case of N = 4096, a roughly 6 minute computer run becomes a 1 second run. The development (or, perhaps, reinvention, since the basic idea goes all the way back to Gauss) of the FFT was a major advance in numerical analysis, which enables the computations on the following pages to be performed extremely efficiently. Subroutines for computing FFTs and inverse FFTs are available in all computer languages commonly used in science (Fortran, C, IDL, Matlab, etc). Fortunately we do not need to concern ourselves here with the details of how the FFT algorithm actually works, any more than we need to worry about how a canned subroutine actually computes the cosine of a number. If you are interested in how the FFT works, a web search will yield many detailed explanations. It is important to remember that the FFT is not another type of transform; the FFT is a numerically efficient way to evaluate the DFT if the number of data values is a power of two.

The one-dimensional (1-D) equations seen above are easily extended to two or more dimensions. For two dimensions (x,y), we can sample a region of size Lx by Ly meters over Nx points in the x direction and Ny points in the y direction, with Nx and Ny both powers of 2 so we can use FFTs. Equations (5) and (6) then become

z(xr,ys) = a0 2 + u=1Nx2 v=1Ny2 a u,v cos(kuxr + kvys) + bu,v sin(kuxr + kvys) = u=Nx2+1Nx2 v=Ny2+1Ny2c u,vei(kuxr+kvys). (9)

The corresponding 2-D DFT pair is

(u,v) 𝒟{z(r,s)} 1 NxNy r=0Nx1 s=0Ny1z(r,s)ei2π(ruNx+svNy) (10)


z(r,s) 𝒟1{(u,v)} u=0Nx1 v=0Ny1(u,v)e+i2π(ruNx+svNy). (11)

It will be important below to keep notational track of continuous vs. discrete versions of various functions. For any variable 𝒮, 𝒮(k) will denote a continuous function of k, 𝒮(k = ku) will denote the continuous function evaluated at the discrete value ku, and 𝒮(ku) = 𝒮(u) will denote a discrete point function. Keep in mind that the density function 𝒮(k = ku) and the point function 𝒮(ku) have different units. In the following pages 𝒮(k) and 𝒮(ku) will denote the continuous and discrete versions, respectively, of wave elevation variance spectra.

The differences in units between continuous and discrete Fourier amplitudes sometimes makes it tricky to make the transition between discrete and continuous versions of the same quantity. In particular, it will be necessary to explicitly include the frequency intervals in some of the later calculations that involve both continuous and discrete variables. For example, if we have a continuous density function and we need to convert to a corresponding discrete function, we must multiple the continuous function by the finite frequency interval, e.g.

(u) = (ν = νu)Δν. (12)

Conversely, if we have discrete amplitudes (u) and we wish to estimate the continuous spectral density (ν), then we must divide by the frequency interval:

(ν) = (u)Δν. (13)

(If you are an optical oceanographer familiar with the scattering phase function, you can find an analogous situation in the estimation of the scattering phase function from measurements of scattered light. The scattering phase function is a measure of how much light energy is scattered from an incident direction into a particular direction, per unit solid angle; it therefore has units of 1/steradian. If you measure the scattered light using an instrument with a finite solid angle ΔΩ, then you get the total amount of energy scattered into the solid angle ΔΩ. To estimate the phase function from this measurement, you must divide the measured value by the solid angle of the instrument; this gets you back to units of 1/steradian.)

Frequency Ordering

There is a peculiarity to most (perhaps all) FFT subroutines. The discrete FFT of Eq. (7) returns an array of N complex numbers (u), which are associated with N discrete spatial frequencies. What is peculiar is the order in which the elements of the (u) array are returned by an FFT subroutine.

Let Δf represent the fundamental frequency. If wavenumber ν is the frequency variable, then Δf = 1L. If angular spatial frequency k is the frequency variable, then Δf = 2πL; for temporal angular frequency ω, Δf = 2πT. In any case, the discrete frequencies associated with the discrete Fourier amplitudes are equally spaced at intervals of Δf and are in the negative-to-positive order

N 2 + 1,N 2 + 2,...,1, 0, 1,..., N 2 1, N 2 Δf. (14)

I’ll call this the “math frequency order” because this is the natural order of arranging values in mathematics. This frequency order is convenient for plotting all of the amplitudes, as will be seen in the following pages. Plots showing both negative and positive frequencies are called “two-sided,” and examples will be seen below.

However, FFT routines generally return their amplitudes corresponding to frequencies in the order of 0 first, then the positive frequencies from the smallest to the Nyquist frequency, then the negative frequencies in reverse order:

0, 1,..., N 2 1, N 2 ,N 2 + 1,N 2 + 2,...,1, Δf. (15)

I’ll call this the “FFT frequency order.” Given the Hermitian symmetry of the amplitudes about the 0 frequency, the FFT order is convenient for plotting amplitudes only for the positive frequencies, with the negative-positive symmetry of understood. Such plots are called “one-sided” or “folded.”

Either frequency order can be obtained from the other by a repeated circular shift, which moves an array element off of one end of an array and copies it to the other end of the array, shifting all elements right or left by one position in the process. The detail to watch is that different computer languages define a circular shift in different ways. For example, the IDL routine SHIFT (and the Matlab routine CIRCSHIFT) moves the array elements to the right for a “positive” shift (a negative shift moves elements to the left), whereas the Fortran 95 CSHIFT routine moves the array elements to the left for a positive shift (a negative shift moves elements to the right). Thus

math order = SHIFT(FFT order, N/2-1)
FFT order = SHIFT(math order, -(N/2-1))
In Fortran95:
math order = CSHIFT(FFT order, -(N/2-1))
FFT order = CSHIFT(math order, N/2-1)

Some FFT routines allow the user to set a flag specifying which frequency order is to be returned. In any case, sorting out the frequency order of the amplitudes returned by a particular FFT routine, and figuring out how to shift between math and FFT frequency orders in a particular computer language, can drive you to tears.

Note finally that in Eq. (7) you are simply providing an array of z(r) values and getting back the same number of (u) values. What x(r) values correspond to the z(r) values is irrelevant. That is, x(r),r = 0,...,N 1 might correspond to the spatial range from x = 0 to L, or from x = L2 to L2, or to any other x range. It is only the number of samples N and the corresponding z(u) values that matters. In other words, the amplitudes coming out of the Fourier transform are independent of the origin of the spatial coordinate system. The frequencies depend on both the number of points N and the physical size of the sampled region via the presence of L (or time interval T) in the fundamental frequency Δf. Thus the size of the region sampled and the number of samples, along with the sample values themselves, fully define the associated Fourier transforms.

Interpretation of Negative Frequencies

The appearance of negative frequencies in Fourier transforms may seem somewhat mysterious. Frequency, after all, is a physical quantity that is inherently a positive number, e.g., the number of wavelengths in a given distance. However, one way to interpret mathematically negative frequencies is that they are simply the mathematical price we pay for the convenience of using complex numbers. Consider, for example, the representation of the cosine as a sum of complex exponentials for the uth frequency:

cos(2πνuxr) = 1 2 ei2πνuxr + ei2πνuxr = 1 2 ei2π(+νu)xr + ei2π(νu)xr .

We can interpret the complex representation of the real cosine as having one term with a positive frequency + νu and one term with a negative frequency νu. A similar equation holds for the complex representation of sin(2πνuxr). The Fourier transform of a real function always contains both negative and positive frequencies, which arise from the complex exponentials in the definition of the transform.

Additional comments about negative frequencies will be made on later pages, where it will be seen that positive frequencies can be associated with waves propagating in the + x direction, and negative frequencies correspond to waves propagating in the opposite, x, direction.

Parseval’s Relations

The physical and spectral variables of a continuous Fourier transform pair satisfy

|z(x)|2dx =|(ν)|2dν, (16)

which is known as Parseval’s relation. For complex amplitudes, ||2 = . The corresponding equation for the discrete Fourier transform pair defined by Eqs (7) and (8) is

r=0N1|z(r)|2 = N u=0N1|(u)|2. (17)

The extension to the two-dimensional case is straightforward:

r=0Nx1 s=0Ny1|z(r,s)|2 = N xNy u=0Nx1 v=0Ny1|(u,v)|2. (18)

The discrete forms of Parseval’s relations provide important checks on numerical calculations. For example, it is easy to misplace factors of N, which appear in different places depending on the exact form used for the definition of the discrete transforms.

You can take a class in Fourier transforms and prove many more beautiful theorems about their properties. However, we have now assembled the mathematical tools needed to describe wind-blown sea surfaces, and so we can now get back to oceanography.

Comments for Fourier Transforms:

Loading Conversation