**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\left(x\right)$ of a continuous variable $x$, the Fourier transform $\u1e91\left(\nu \right)$ of $z\left(x\right)$ is deﬁned as

$$\u1e91\left(\nu \right)\equiv \mathcal{\mathcal{F}}\left\{z\left(x\right)\right\}\equiv {\int}_{-\infty}^{\infty}z\left(x\right){e}^{-i2\pi \nu x}dx\phantom{\rule{0.3em}{0ex}}.$$ | (1) |

The inverse Fourier transform is given by

It can be shown that if we insert the $\u1e91\left(\nu \right)$ integral of Eq. (1) into Eq. (2), we recover $z\left(x\right)$. (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\left(x\right)$ is sea surface elevation, and both $z$ and $x$ have units of meters. Equation (1) shows that $\u1e91\left(\nu \right)$ thus has units of ${m}^{2}$. The variance of $z$ also has units of ${m}^{2}$, which gives the ﬁrst hint at a profound connection between the variance of a physical quantity and its Fourier transform. The units of ${m}^{2}$ in the Fourier transform can be rewritten as m/(1/m), which is units of $z$ divided by units of spatial frequency $\nu $. Indeed, the transform $\u1e91\left(\nu \right)$ 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 deﬁnitions above with the $2\pi $ 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\pi \nu $ as the frequency variable, then Eqs. (1) and (2) become

$$\u1e91\left(k\right)\equiv \mathcal{\mathcal{F}}\left\{z\left(x\right)\right\}\equiv {\int}_{-\infty}^{\infty}z\left(x\right){e}^{-ikx}dx$$ | (3) |

and

$$z\left(x\right)\equiv {\mathcal{\mathcal{F}}}^{-1}\left\{\u1e91\left(k\right)\right\}\equiv \frac{1}{2\pi}{\int}_{-\infty}^{\infty}\u1e91\left(k\right){e}^{+ikx}dk\phantom{\rule{0.3em}{0ex}}.$$ | (4) |

This reappearance of the $2\pi $ in the second equation is required so that the inverse transform of the transform gets you back to where you started. In the ${e}^{\pm ikx}$ version, some people put the $1\u22152\pi $ in front of the other integral, and some put a $1\u2215\sqrt{2\pi}$ 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\pi $ is almost a religion—most people stay with what they ﬁrst learned, are convinced of the superiority of their deﬁnition, and are willing to die rather than change. Fortunately, it doesn’t matter which deﬁnitions you use, so long as you are consistent in how the transform pair is deﬁned so that you get back to where you started if you inverse transform a transform, or vice versa.

In our work, $z\left(x\right)$ is the sea surface elevation, which is a real number. However, even though $z\left(x\right)$ is real, $\u1e91\left(\nu \right)$ (or $\u1e91\left(k\right)$) is complex. Expanding the complex exponential in Eq. (1) as the sum of a cosine and a sine, it is easy to see that ${\u1e91}^{\ast}\left(\nu \right)=\u1e91\left(-\nu \right)$. 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 $\u1e91$ so that we end up with a real sea surface.

### Discrete Fourier Transforms

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

$$z\left({x}_{r}\right)=\frac{{a}_{0}}{2}+\sum _{u=1}^{N\u22152}\left[{a}_{u}cos\left({k}_{u}{x}_{r}\right)+{b}_{u}sin\left({k}_{u}{x}_{r}\right)\right]\phantom{\rule{0.3em}{0ex}},$$ | (5) |

with ${b}_{N\u22152}\equiv 0$. Note that the sum runs from the fundamental frequency ($u=1,{k}_{1}=2\pi \u2215L$) through the Nyquist frequency ($u=N\u22152,{k}_{N\u22152}=2\pi \u2215\left(2\Delta x\right)$), with only a cosine term for the two-point wave. This sum is equivalent to

$$z\left({x}_{r}\right)=\sum _{u=-N\u22152+1}^{N\u22152}{c}_{u}{e}^{i{k}_{u}{x}_{r}}\phantom{\rule{0.3em}{0ex}},$$ | (6) |

which also contains a total of $N$ independent real and imaginary parts of the ${c}_{n}$ coeﬃcients. (Recall from Eq. (5) of the previous page that ${c}_{-k}={c}_{k}^{\ast}$, so these coeﬃcients 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 $\sqrt{-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., $\left({x}_{r},{y}_{s}\right)$, and $u$ and $v$ for indices on frequency variables, e.g., ${k}_{u}$ or ${\nu}_{v}$. $n$ and $m$ also will be used as needed for dummy indices.

We now have a ﬁnite number $N$ of discrete samples $z\left({x}_{r}\right)$ of the sea surface, so we need a discrete form of the Fourier transform. The discrete Fourier transform (DFT) of $z\left({x}_{r}\right)$ is deﬁned as

$$\u1e91\left({\nu}_{u}\right)\equiv \mathcal{\mathcal{D}}\left\{z\left({x}_{r}\right)\right\}\equiv \frac{1}{N}\sum _{r=0}^{N-1}z\left({x}_{r}\right){e}^{-i2\pi {\nu}_{u}{x}_{r}}\phantom{\rule{0.3em}{0ex}}.$$ |

for $u=0,1,....,N-1$. Recalling that ${\nu}_{u}=u\u2215L=u\u2215\left(N\Delta x\right)$ and ${x}_{r}=r\Delta x=rL\u2215N$ gives ${\nu}_{u}{x}_{r}=ru\u2215N$. It is also common to write $z\left({x}_{r}\right)=z\left(r\right)$ and $\u1e91\left({\nu}_{u}\right)=\u1e91\left(u\right)$, in which case the previous equation becomes

$$\u1e91\left(u\right)\equiv \mathcal{\mathcal{D}}\left\{z\left(r\right)\right\}\equiv \frac{1}{N}\sum _{r=0}^{N-1}z\left(r\right){e}^{-i2\pi ru\u2215N}\phantom{\rule{0.3em}{0ex}}.$$ | (7) |

The corresponding inverse discrete Fourier transform is given by

$$z\left(r\right)\equiv {\mathcal{\mathcal{D}}}^{-1}\left\{\u1e91\left(u\right)\right\}\equiv \sum _{u=0}^{N-1}\u1e91\left(u\right){e}^{+i2\pi ru\u2215N}\phantom{\rule{0.3em}{0ex}}.$$ | (8) |

It was emphasized above that the continuous function $\u1e91\left(\nu \right)$ deﬁned by the continuous Fourier transform (1) is a density function with units of $z\left(x\right)$ per spatial frequency interval, e.g., m/(1/m) if $z$ is sea surface height in meters. However, the discrete function $\u1e91\left(u\right)$ deﬁned by the discrete Fourier transform (7) has the same units as $z\left(r\right)$. The discrete Fourier transform is a point function that shows how much of $z\left(r\right)$ is contained in a ﬁnite frequency interval $\Delta \nu =1\u2215L$ centered at frequency ${\nu}_{u}=u\u2215L$. Discrete Fourier transforms convert point functions $z\left(r\right)$ to point functions $\u1e91\left(u\right)$.

The $\mathcal{\mathcal{F}}$ and $\mathcal{\mathcal{D}}$ notations will be used to distinguish continuous vs. discrete Fourier transforms. As just seen, the continuous and discrete transforms are diﬀerent mathematical constructs with diﬀerent units and interpretations; they must not be confused. Likewise, if necessary, a subscript can be appended to show the frequency variable, e.g., ${\mathcal{\mathcal{F}}}_{\nu}\left\{z\left(x\right)\right\}$ as in Eq. (1) or ${\mathcal{\mathcal{F}}}_{k}\left\{z\left(x\right)\right\}$ as in Eq. (3). As always, there are competing deﬁnitions. Equations (7) and (8) are used in Bracewell and the IDL computer language. Numerical Recipes interchanges the $i$ and $-i$. Matlab puts the $1\u2215N$ 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 $\left(r-1\right)\left(u-1\right)$ in the exponentials. The devil is in the details, and details like where to put the $1\u2215N$ factor and diﬀerences in array indexing in diﬀerent computer languages can cause great misery when it comes time to actually write computer programs or to compare results computed by diﬀerent 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\left(r\right)$ or $\u1e91\left(u\right)$ 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 ${N}^{2}$. 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}_{2}N$ computations, if $N$ is a power of 2. Their technique is now called the Fast Fourier Transform or FFT. The diﬀerence in computer time becomes enormous for large $N$. For example, if $N={2}^{12}=4096$, then $N{log}_{2}N=4096\times 12$, and the diﬀerence in computation time is a factor of ${N}^{2}\u2215\left(N{log}_{2}N\right)\approx 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 eﬃciently. 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 eﬃcient 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 $\left(x,y\right)$, we can sample a region of size ${L}_{x}$ by ${L}_{y}$ meters over ${N}_{x}$ points in the $x$ direction and ${N}_{y}$ points in the $y$ direction, with ${N}_{x}$ and ${N}_{y}$ both powers of 2 so we can use FFTs. Equations (5) and (6) then become

$$\begin{array}{llll}\hfill z\left({x}_{r},{y}_{s}\right)=& \frac{{a}_{0}}{2}+\sum _{u=1}^{{N}_{x}\u22152}\sum _{v=1}^{{N}_{y}\u22152}\left[{a}_{u,v}cos\left({k}_{u}{x}_{r}+{k}_{v}{y}_{s}\right)+{b}_{u,v}sin\left({k}_{u}{x}_{r}+{k}_{v}{y}_{s}\right)\right]\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill =& \sum _{u=-{N}_{x}\u22152+1}^{{N}_{x}\u22152}\sum _{v=-{N}_{y}\u22152+1}^{{N}_{y}\u22152}{c}_{u,v}{e}^{i\left({k}_{u}{x}_{r}+{k}_{v}{y}_{s}\right)}\phantom{\rule{0.3em}{0ex}}.\phantom{\rule{2em}{0ex}}& \hfill \text{(9)}\end{array}$$The corresponding 2-D DFT pair is

and

It will be important below to keep notational track of continuous vs. discrete versions of various functions. For any variable $\mathcal{\mathcal{S}}$, $\mathcal{\mathcal{S}}\left(k\right)$ will denote a continuous function of $k$, $\mathcal{\mathcal{S}}\left(k={k}_{u}\right)$ will denote the continuous function evaluated at the discrete value ${k}_{u}$, and $\mathcal{\mathcal{S}}\left({k}_{u}\right)=\mathcal{\mathcal{S}}\left(u\right)$ will denote a discrete point function. Keep in mind that the density function $\mathcal{\mathcal{S}}\left(k={k}_{u}\right)$ and the point function $\mathcal{\mathcal{S}}\left({k}_{u}\right)$ have diﬀerent units. In the following pages $\mathcal{\mathcal{S}}\left(k\right)$ and $\mathcal{\mathcal{S}}\left({k}_{u}\right)$ will denote the continuous and discrete versions, respectively, of wave elevation variance spectra.

The diﬀerences 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 ﬁnite frequency interval, e.g.

$$\u1e91\left(u\right)=\u1e91\left(\nu ={\nu}_{u}\right)\Delta \nu \phantom{\rule{0.3em}{0ex}}.$$ | (12) |

Conversely, if we have discrete amplitudes $\u1e91\left(u\right)$ and we wish to estimate the continuous spectral density $\u1e91\left(\nu \right)$, then we must divide by the frequency interval:

$$\u1e91\left(\nu \right)=\u1e91\left(u\right)\u2215\Delta \nu \phantom{\rule{0.3em}{0ex}}.$$ | (13) |

(If you are an optical oceanographer familiar with the scattering phase function, you can ﬁnd 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 ﬁnite solid angle $\Delta \Omega $, then you get the total amount of energy scattered into the solid angle $\Delta \Omega $. 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 $\u1e91\left(u\right)$, which are associated with $N$ discrete spatial frequencies. What is peculiar is the order in which the elements of the $\u1e91\left(u\right)$ array are returned by an FFT subroutine.

Let ${\Delta}_{f}$ represent the fundamental frequency. If wavenumber $\nu $ is the frequency variable, then ${\Delta}_{f}=1\u2215L$. If angular spatial frequency $k$ is the frequency variable, then ${\Delta}_{f}=2\pi \u2215L$; for temporal angular frequency $\omega $, ${\Delta}_{f}=2\pi \u2215T$. In any case, the discrete frequencies associated with the discrete Fourier amplitudes are equally spaced at intervals of ${\Delta}_{f}$ and are in the negative-to-positive order

$$\left\{-\frac{N}{2}+1,-\frac{N}{2}+2,...,-1,0,1,...,\frac{N}{2}-1,\frac{N}{2}\right\}{\Delta}_{f}\phantom{\rule{0.3em}{0ex}}.$$ | (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 ﬁrst, then the positive frequencies from the smallest to the Nyquist frequency, then the negative frequencies in reverse order:

$$\left\{0,1,...,\frac{N}{2}-1,\frac{N}{2},-\frac{N}{2}+1,-\frac{N}{2}+2,...,-1,\right\}{\Delta}_{f}\phantom{\rule{0.3em}{0ex}}.$$ | (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 $\u1e91$ 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 oﬀ 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 diﬀerent computer languages deﬁne a circular shift in diﬀerent 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

- In IDL:
- 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 ﬂag 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 ﬁguring out how to shift between math and FFT frequency orders in a particular computer language, can drive you to tears.

Note ﬁnally that in Eq. (7) you are simply providing an array of $z\left(r\right)$ values and getting back the same number of $\u1e91\left(u\right)$ values. What $x\left(r\right)$ values correspond to the $z\left(r\right)$ values is irrelevant. That is, $x\left(r\right),r=0,...,N-1$ might correspond to the spatial range from $x=0$ to $L$, or from $x=-L\u22152$ to $L\u22152$, or to any other $x$ range. It is only the number of samples $N$ and the corresponding $z\left(u\right)$ 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 ${\Delta}_{f}$. Thus the size of the region sampled and the number of samples, along with the sample values themselves, fully deﬁne 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 ${u}^{th}$ frequency:

$$\begin{array}{llll}\hfill cos\left(2\pi {\nu}_{u}{x}_{r}\right)=& \frac{1}{2}\left({e}^{i2\pi {\nu}_{u}{x}_{r}}+{e}^{-i2\pi {\nu}_{u}{x}_{r}}\right)\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\\ \hfill =& \frac{1}{2}\left({e}^{i2\pi \left(+{\nu}_{u}\right){x}_{r}}+{e}^{i2\pi \left(-{\nu}_{u}\right){x}_{r}}\right)\phantom{\rule{0.3em}{0ex}}.\phantom{\rule{2em}{0ex}}& \hfill & \phantom{\rule{2em}{0ex}}\end{array}$$We can interpret the complex representation of the real cosine as having one term with a positive frequency $+{\nu}_{u}$ and one term with a negative frequency $-{\nu}_{u}$. A similar equation holds for the complex representation of $sin\left(2\pi {\nu}_{u}{x}_{r}\right)$. The Fourier transform of a real function always contains both negative and positive frequencies, which arise from the complex exponentials in the deﬁnition 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

$${\int}_{-\infty}^{\infty}|z\left(x\right){|}^{2}dx={\int}_{-\infty}^{\infty}|\u1e91\left(\nu \right){|}^{2}d\nu \phantom{\rule{0.3em}{0ex}},$$ | (16) |

which is known as Parseval’s relation. For complex amplitudes, $|\u1e91{|}^{2}=\u1e91{\u1e91}^{\ast}$. The corresponding equation for the discrete Fourier transform pair deﬁned by Eqs (7) and (8) is

$$\sum _{r=0}^{N-1}|z\left(r\right){|}^{2}=N\sum _{u=0}^{N-1}|\u1e91\left(u\right){|}^{2}\phantom{\rule{0.3em}{0ex}}.$$ | (17) |

The extension to the two-dimensional case is straightforward:

$$\sum _{r=0}^{{N}_{x}-1}\sum _{s=0}^{{N}_{y}-1}|z\left(r,s\right){|}^{2}={N}_{x}{N}_{y}\sum _{u=0}^{{N}_{x}-1}\sum _{v=0}^{{N}_{y}-1}|\u1e91\left(u,v\right){|}^{2}\phantom{\rule{0.3em}{0ex}}.$$ | (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 diﬀerent places depending on the exact form used for the deﬁnition 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.