Fourier Transforms#

The Fourier Family#

Fourier Series#

Due to the orthogonality of sine and cosine functions, Fourier series can be used to represent arbitrary periodic functions through spectral decomposition:

\[\begin{align} f\!\left[t\right] &= \sum_{n=-\infty}^{\infty} a_n e^{i \left(2 \pi \, t \, n/\Delta t\right)}, & a_n &= \frac{1}{\Delta t} \int_{-\Delta t/2}^{\Delta t/2} f\!\left[t\right] e^{-i \left(2 \pi \, t \, n/\Delta t\right)} dt \end{align}\]
\[\begin{gather} \Delta t = \text{the period of } f\!\left[t\right] \end{gather}\]

This relationship can alternatively be expressed as follows:

\[\begin{align} f\!\left[t\right] &= \sum_{n=-\infty}^{\infty} F\!\left[\nu_n\right] e^{i \left(2 \pi \, t \, \nu_n \right)} d\nu, & F\!\left[\nu_n\right] &= \int_{-\Delta t/2}^{\Delta t/2} f\!\left[t\right] e^{-i \left(2 \pi \, t \, \nu_n\right)} dt \end{align}\]
\[\begin{gather} d\nu = 1/\Delta t, \qquad \nu_n = n \, d\nu \end{gather}\]

where we have replaced \(a_n\) with \(F\!\left[\nu_n\right]\) and pulled out the normalization constant (\(1/\Delta t\)) from the right equation to the left. This form emphasizes that the Fourier series is an integral transform between two continuous functions (\(f\!\left[t\right]\) and \(F\!\left[\nu\right]\)). The forward and inverse kernels only differ by the sign in the exponential, \(\exp\left[- i \left(2 \pi \, t \, \nu \right) \right]\) and \(\exp\left[+ i \left(2 \pi \, t \, \nu \right) \right]\).

Discrete Fourier Transforms#

An important numeric simplification arises due to the sampling theorem. A continuous, periodic signal can be discretely sampled without any loss of information if the sample rate is more than twice the highest frequency in the signal. When this condition holds, the above relationships can be cast as discrete Fourier transforms (DFTs):

\[\begin{align} f\!\left[t_m\right] &= \sum_{n=-\lfloor N/2 \rfloor}^{\lfloor (N-1)/2 \rfloor} F\!\left[\nu_n\right] e^{i \left(2 \pi \ t_m \ \nu_n \right)} d\nu & F\!\left[\nu_n\right] &= \sum_{m=-\lfloor N/2 \rfloor}^{\lfloor (N-1)/2 \rfloor} f\!\left[t_m\right] e^{-i \left(2 \pi \ t_m \ \nu_n\right)} dt \end{align}\]
\[\begin{split}\begin{gather} t_m = m \, dt, \qquad \nu_n = n \, d\nu \\ N = \text{the number of sampled points} \\ N d\nu = 1 /dt = \text{the sample rate} \end{gather}\end{split}\]

where \(\lfloor ... \rfloor\) represents the floor function, and the range of the summation indices \(m\) and \(n\) are chosen so that the summation indices are the same as the coordinate indices. The transform given by the first equation is called the inverse Fourier transform (\(\nu \to t\)) and that given by the second is called the Fourier transform (\(t \to \nu\)). The definitions require sampling at a discrete set of points, but these relationships carry no approximations with respect to the periodic functions \(f\!\left[t\right]\) or \(F\!\left[\nu\right]\). Due to the efficient fast Fourier transform (FFT) algorithms, DFTs are preferred when performing Fourier transforms numerically.

An interesting side effect of the discrete Fourier transform is that along with the periodicity of the time domain, the representation in the frequency domain becomes periodic as well. The time range \(\pm 1/(2 \, d\nu)\) is the periodic time window that corresponds to sampling the frequency domain in steps of \(d\nu\). Similarly, the frequency range \(\pm 1/ (2 \, dt)\) is the periodic frequency window due to sampling the time domain in steps of \(dt\). The frequency \(\nu = 1/ (2 \, dt)\) is called the Nyquist frequency and is the maximum allowed frequency for a given time-domain step size. Components that are at frequencies greater than the Nyquist frequency will alias, or wrap, back onto the primary grid.

The above equations represent discrete integrals over points that are centered on \(t_m\) (\(\nu_n\)) and extend in bins of \(\pm 0.5 \, dt\) (\(\pm 0.5 \, d\nu\)). Thus, the transforms span the entire periodic windows:

\[\begin{align} \Delta t &= N \, dt = 1 / d\nu, & \Delta \nu &= N \, d\nu = 1/dt \end{align}\]

This is readily seen for grids that contain an odd number of points but requires some more careful consideration when the number of points is even. The minimum coordinate index in that case is \(-N/2\), which is exactly at the Nyquist frequency, and the maximum index is at \(N/2 - 1\), which is one step size below Nyquist. To complete the window, one must alias the half step down from \(-N/2\) to the half step up from \(N/2 -1\). This means that for an even number of points the information at the positive Nyquist frequency is aliased down to the negative. While there is enough information to fully represent the sampled points, as predicted by the sampling theorem there is in general not enough to reconstruct the sampled function in its entirety. Thus, a discrete Fourier transform sampled with an even number of points is only generally valid if there is no amplitude at the Nyquist component. One special exception is the discrete Fourier transform of a purely real function. For this case, due to the complex-conjugate symmetry inherent to the Fourier transform of a real function the positive and negative Nyquist terms are real and equal, so a DFT sampled at the Nyquist frequency will return two times the amplitude of the actual Nyquist components. The full real-valued function can then be reconstructed by taking half of the amplitude of the negative Nyquist component and placing it in a frequency bin at the positive Nyquist component.

Continuous Fourier Transforms#

The continuous Fourier transform (FT) is derived by extending the Fourier series’ time window to infinity:

\[\begin{gather} d\nu \to 0 \quad \text{and} \quad T \to \infty \end{gather}\]
\[\begin{align} f\!\left[t\right] &= \int_{-\infty}^{\infty} F\!\left[\nu\right] e^{+i \left(2 \pi \ t \ \nu\right)} d\nu & F\!\left[\nu\right] &= \int_{-\infty}^{\infty} f\!\left[t\right] e^{-i \left(2 \pi \ t \ \nu\right)} dt \end{align}\]

These elegant relationships are useful for representing the frequency content of arbitrary continuous functions but yield more complicated representations than Fourier series or DFTs when the function of interest is itself periodic.

Useful Relationships#

The relationships of this section are true for both discrete and continuous Fourier transforms. The following generalized notation will be used going forward:

\[\begin{split}\begin{align} \text{Fourier Transform:} \quad & F\!\left[\nu\right] = \mathscr{F}\!\Bigl[f\!\left[t\right]\Bigr] \\ \text{Inverse Fourier Transform:} \quad & f\!\left[t\right] = \mathscr{F}^{-1}\!\Bigl[F\!\left[\nu\right]\Bigr] \\ \text{Summation or Integration:} \quad & \int_{-\infty}^{\infty} ... \end{align}\end{split}\]

For the discrete case, the summation is assumed to be across all points up to the Nyquist time or frequency.

Linearity#

\[\begin{align} a \, f\!\left[t\right] + b \, g\!\left[t\right] &= \mathscr{F}^{-1}\!\Bigl[ a \, F\!\left[\nu\right] + b \, G\!\left[\nu\right] \Bigr] & a \, F\!\left[\nu\right] + b \, G\!\left[\nu\right] &= \mathscr{F}\!\Bigl[ a \, f\!\left[t\right] + b \, g\!\left[t\right] \Bigr] \end{align}\]

Shifting and Scaling#

\[\begin{split}\begin{align} f\!\left[t-t_0\right] &= \mathscr{F}^{-1}\!\left[F\!\left[\nu\right] e^{-i \left(2 \pi \, t_0 \, \nu\right)}\right] & F\!\left[\nu - \nu_0\right] &= \mathscr{F}\!\left[f\!\left[t\right] e^{+i \left(2 \pi \, t \, \nu_0 \right)} \right] \\ f\!\left[a \, t\right] &= \mathscr{F}^{-1}\!\left[\frac{1}{\left\vert a \right\vert} F\!\left[\nu / a\right] \right] & F\!\left[a \, \nu \right] &= \mathscr{F}\!\left[\frac{1}{\left\vert a \right\vert} f\!\left[t / a\right] \right] \end{align}\end{split}\]

Derivatives and Integrals#

\[\begin{align} \frac{d^{n}}{dt^{n}} f\!\left[t\right] &= \mathscr{F}^{-1}\!\Bigl[ \left(+i \, 2 \pi \, \nu\right)^{n} F\!\left[\nu\right] \Bigr] & \frac{d^{n}}{d\nu^{n}} F\!\left[\nu\right] &= \mathscr{F}\!\Bigl[ \left(-i \, 2 \pi \, t\right)^{n} f\!\left[t\right] \Bigr] \end{align}\]

Positive integer values of \(n\) represent derivatives and negative integers represent integrals (antiderivatives). All other values of \(n\) represent derivatives and integrals in the realm of fractional calculus.

Convolutions#

Convolution is defined as:

\[\begin{split}\begin{align} \left(f * g\right)\!\left[t\right] &= \iint_{-\infty}^{\infty} f\!\left[t_1\right] g\!\left[t_2\right] \delta\!\left[t - \left(t_1 + t_2\right)\right] dt_1 \, dt_2 \\ \left(F * G\right)\!\left[\nu\right] &= \int_{-\infty}^{\infty} F\!\left[\nu_1\right] G\!\left[\nu_2\right] \delta\!\left[\nu - \left(\nu_1 + \nu_2\right)\right] d\nu_1 \, d\nu_2 \end{align}\end{split}\]

The convolution of two functions in one domain is the product of the Fourier transforms in the other:

\[\begin{align} \left(f * g\right)\!\left[t\right] &= \mathscr{F}^{-1}\!\Bigl[ F\!\left[\nu\right] G\!\left[\nu\right] \Bigr] & \left(F * G\right)\!\left[\nu\right] &= \mathscr{F}\!\Bigl[ f\!\left[t\right] g\!\left[t\right] \Bigr] \end{align}\]

The support of a convolution is the sum of the support of its parts. In order to avoid aliasing when on a discrete grid, the sum of the supports of the functions to be convolved should be less than the range of the gridded time or frequency domains.

Cross-Correlation#

Cross-correlation is defined as:

\[\begin{split}\begin{align} \left(f \star g\right)\!\left[t\right] &= \iint_{-\infty}^{\infty} \overline{f}\!\left[t_1\right] g\!\left[t_2\right] \delta\!\left[t + \left(t_1 - t_2\right)\right] dt_1 \, dt_2 \\ \left(F \star G\right)\!\left[\nu\right] &= \int_{-\infty}^{\infty} \overline{F}\!\left[\nu_1\right] G\!\left[\nu_2\right] \delta\!\left[\nu + \left(\nu_1 - \nu_2\right)\right] d\nu_1 \, d\nu_2 \end{align}\end{split}\]

where the barred symbols \((\overline{f}, \overline{F})\) indicate complex conjugates.

The cross-correlation of two functions in one domain is the product of the Fourier transforms in the other domain, with the first function conjugated:

\[\begin{align} \left(f \star g\right)\!\left[t\right] &= \mathscr{F}^{-1}\!\Bigl[ \overline{F}\!\left[\nu\right] G\!\left[\nu\right] \Bigr] & \left(F \star G\right)\!\left[\nu\right] &= \mathscr{F}\!\Bigl[ \overline{f}\!\left[t\right] g\!\left[t\right] \Bigr] \end{align}\]

Normalization#

\[\begin{gather} E = \int_{-\infty}^{\infty} \Bigl\vert f\!\left[t\right] \Bigr\vert^{2} dt = \int_{-\infty}^{\infty} \Bigl\vert F\!\left[\nu\right] \Bigr\vert^{2} d\nu \end{gather}\]

This follows from Parseval’s Theorem for Fourier series, or equivalently, from Plancherel’s Theorem for continuous Fourier transforms. In optics, these expressions yield the total energy of a pulse or spectrum.

Real Functions and the Analytic Representation#

If \(f\!\left[t\right]\) is real, from the even and odd symmetry of the cosine and sine functions (\(e^{i \omega t} = \cos\left[\omega t\right] + i \sin\left[\omega t\right]\)), the real and imaginary components of \(F\!\left[\nu\right]\) have even and odd symmetry about the origin, i.e. \(F\!\left[-\nu\right] = \overline{F}\!\left[\nu\right]\). This symmetry can be used to simplify the representation of real functions as all information can be reconstructed from either the positive or negative half of the spectrum. One possible simplification takes advantage of the normalization relationship:

\[\begin{split}\begin{align} E &= \int_{-\infty}^{\infty} \Bigl\vert f\!\left[t\right] \Bigr\vert^{2} dt = \int_{-\infty}^{\infty} \Bigl\vert F\!\left[\nu\right] \Bigr\vert^{2} d\nu \\ &= 2 \int_{0}^{\infty} \Bigl\vert F\!\left[\nu\right] \Bigr\vert^{2} d\nu = \int_{0}^{\infty} \Bigl\vert \sqrt{2} \ F\!\left[\nu\right] \Bigr\vert^{2} d\nu \end{align}\end{split}\]

If we replace the quantity in the last absolute value with a single expression, we arrive at what is called an analytic representation:

\[\begin{split}\begin{gather} E = \int_{-\infty}^{\infty} \Bigl\vert A\!\left[\nu\right] \Bigr\vert^{2} d\nu = \int_{-\infty}^{\infty} \Bigl\vert a\!\left[t\right] \Bigr\vert^{2} dt \\ A\!\left[\nu\right] = \begin{cases} \sqrt{2} \ F\!\left[\nu\right] & \text{if $\nu \geq 0$} \\ 0 & \text{if $\nu \lt 0$} \end{cases} \\ a\!\left[t\right] = \mathscr{F}^{-1}\!\Bigl[ A\!\left[\nu\right] \Bigr] \qquad A\!\left[\nu\right] = \mathscr{F}\!\Bigl[ a\!\left[t\right] \Bigr] \end{gather}\end{split}\]

Analytic spectra can be defined through other means, but this method in particular preserves the normalization relationship.

A further simplification, known as the complex envelope representation, can be made by shifting the analytic spectrum to the origin and discarding points that contain zero amplitude. Since only the support of the analytic spectrum is retained, Fourier transforms and other calculations can be applied more efficiently, i.e. over just a subset of the frequency range required by the equivalent real function:

\[\begin{split}\begin{gather} \nu^{\prime} = \nu - \nu_0 \\ A\!\left[\nu^{\prime}\right] = \begin{cases} \sqrt{2} \ F\!\left[\nu^{\prime} + \nu_0\right] & \text{if $\nu^{\prime} + \nu_0 \geq 0$} \\ 0 & \text{if $\nu^{\prime} + \nu_0 \lt 0$} \end{cases} \\ a\!\left[t^{\prime}\right] = \mathscr{F}^{-1}\!\Bigl[ A\!\left[\nu^{\prime}\right] \Bigr] \qquad A\!\left[\nu^{\prime}\right] = \mathscr{F}\!\Bigl[ a\!\left[t^{\prime}\right] \Bigr] \end{gather}\end{split}\]

Numeric Implementation of DFTs#

Unfortunately, most numeric implementations of DFTs obscure the intuitive aspects of these transforms and so require careful handling. Below are the typical discrete Fourier transform and inverse as defined by popular numeric packages (see numpy.fft or scipy.fft):

\[\begin{split}\begin{align} \text{ifft:} \quad & a\!\left[t_m\right] = \frac{1}{N} \sum_{n=0}^{N-1} A\!\left[\nu_n\right] e^{i \left(2\pi \frac{m \ n}{N}\right)} \\ \text{fft:} \quad & A\!\left[\nu_n\right] = \sum_{m=0}^{N-1} a\!\left[t_m\right] e^{-i \left(2\pi \frac{m \ n}{N}\right)} \end{align}\end{split}\]
  • The expression in the exponential can be derived from the definitions given in the previous section by replacing \(t_m\) and \(\nu_n\) with their corresponding indexed values and using the relationship \(dt \ d\nu = 1/N\). This only represents a refactoring of the notation and is a direct result of indexing the time and frequency domains.

  • The leading \(1/N\) in the definition of the ifft is due to the implementation implicitly defining a unit integer time step. With \(dt = 1\), the frequency step must be \(d\nu = 1/N\). This breaks the energy normalization of Fourier transforms with arbitrary \(dt/d\nu\) ratios and requires explicit removal from all ifft operations.

  • The shifting of the summation indices’ range to strictly positive integers disrupts the monotonic order of the coordinate indices and must be accounted for whenever using fft or ifft operations.

fftshift and ifftshift#

The summation, or array indices range from \(0\) to \(N-1\), but due to aliasing the effective coordinate indices still range from \(-\lfloor N/2 \rfloor\) to \(\lfloor(N-1)/2\rfloor\). The coordinate indices follow the array indices up to the midpoint, but at array index \(\lfloor (N-1)/2 \rfloor +1\) the coordinate grid aliases to \(-\lfloor N/2 \rfloor\). Array indices from \(\lfloor (N-1)/2 \rfloor +1\) to \(N-1\) represent negative time or frequency coordinates.

To avoid numeric artifacts or other erroneous results, fft array ordering must be maintained when using fft and ifft functions. To aid in that endeavor, numeric packages contain fftshift and ifftshift functions which rearrange arrays such that they go from standard fft ordering to arrays with monotonically ordered coordinates and vice versa. In this regard, fftshift is used to translate fft ordering to monotonic ordering, and ifftshift is used to translate monotonic ordering to fft ordering.

The operation of fftshift and ifftshift functions are shown in the table below, where indices at the beginning, middle, and end of an array are shown. The first column is the array index, the second is the fft coordinate index, and the last column is the coordinate index after an fftshift operation. Following an fftshift operation with an ifftshift operation restores fft ordering.

array index

fft coordinate index

coord. index after fftshift(…)

\(0\)

\(0\)

\(-\lfloor N/2\rfloor\)

\(1\)

\(1\)

\(-\lfloor N/2\rfloor+1\)

\(2\)

\(2\)

\(-\lfloor N/2\rfloor+2\)

\(\lfloor(N-1)/2\rfloor\)

\(\lfloor(N-1)/2\rfloor\)

\(-1\)

\(\lfloor(N-1)/2\rfloor+1\)

\(-\lfloor N/2\rfloor\)

\(0\)

\(\lfloor(N-1)/2\rfloor+2\)

\(-\lfloor N/2\rfloor+1\)

\(1\)

\(N-3\)

\(-3\)

\(\lfloor(N-1)/2\rfloor-2\)

\(N-2\)

\(-2\)

\(\lfloor(N-1)/2\rfloor-1\)

\(N-1\)

\(-1\)

\(\lfloor(N-1)/2\rfloor\)

Real DFTs#

Analytic formulations are useful when representing physical quantities, and interface nicely with complex-valued fft and ifft functions. However, there are times when the real-valued representation can be more efficient or practical, such as when dealing with nonlinear operations. Numeric packages include fft implementations that specifically transform real input and that calculate and return only the positive half of a spectrum. With the help of array indexing operations, these rfft and irfft operations allow simple translation between analytic and real-valued representations:

\[\begin{split}\begin{align} \text{irfft:} \quad & f\!\left[t_m\right] = \operatorname{irfft}\!\left( F\!\left[\nu\right] N_r d\nu, \quad n=N_r \right)_m \\ \text{rfft:} \quad & F\!\left[\nu_n\right] = \operatorname{rfft}\!\left( f\!\left[t\right] dt \right)_n \end{align}\end{split}\]
\[\begin{split}\begin{gather} N_r = \text{the number of sampled points in the time domain} \\ dt \, d\nu = 1 / N_r \end{gather}\end{split}\]

An important property of these functions is that the output of a rfft does not have the same number of points as its input. In general, the frequency domain output array has \(N = \lfloor N_r/2 \rfloor + 1\) number of points, where \(N_r\) is the total number of points in the time domain. This does not pose any complications when using the rfft, but in general the number of real output points must be explicitly given to the irfft function. The reduced number of points in the frequency domain has another implication, the frequency domain output array is always arranged such that the coordinates are in monotonic order. The time-domain array is still ordered as described in the previous section, but since the rfft only returns the positive side of the spectrum the array ends before the coordinates have aliased. The slight caveat to this is that the Nyquist frequency (when reached) is considered positive instead of negative.

When transforming between real and analytic representations of a spectrum the first and last points need to be adjusted due to the discrete nature of the frequency bins:

\[\begin{split}\begin{gather} A\!\left[\nu_n\right] = \sqrt{2} \begin{cases} \frac{1}{\sqrt{2}} F\!\left[\nu_n\right] &\text{if $\nu_n = 0$} \\ \\ \frac{1}{2} F\!\left[\nu_n\right] &\text{if $\nu_n = \lfloor N_r/2 \rfloor d\nu$ and } N_r \text{ is even} \\ \\ F\!\left[\nu_n\right] &\text{all other cases} \end{cases} \end{gather}\end{split}\]

The first condition states that the amplitude at the origin of the analytic array is unchanged with respect to the real-valued representation. The frequency bin at the origin extends over both positive and negative frequencies regardless of the representation. To preserve the integrated power, the power in that bin must not change. When the number of points in the real representation is even, the last bin contains information aliased from both the positive and negative Nyquist frequencies. The second condition states that the power is only preserved if one Nyquist component is considered, only half of the combined amplitude can be retained. In addition to the amplitude renormalization, the first and last point of the rfft array must be complex-conjugate symmetric about the origin. This means that the amplitude at the origin must be real, and, if the number of points in the real representation is even, the amplitude at the Nyquist frequency must also be real.

Due to the added complexity of keeping track of those details, it is easier to just not include the origin or the Nyquist frequency in the analytic array, i.e. to have both the origin and the Nyquist frequency of the real-valued representation be configured to have zero amplitude. This is easily accomplished by starting the frequency grid of the analytic representation away from the origin and using an odd number of points if the sampling is Nyquist limited. With that restriction, transformations from one representation to the other need only use a uniform \(\sqrt{2}\) scale factor at all points.

FFT Cookbook#

Use the following set of rules to navigate the normalization and array ordering quirks of fft and ifft functions.

Analytic Representation#

Given the total number of points \(N\), define the time and frequency step sizes \(dt\) and \(d\nu\):

\[\begin{gather} dt \, d\nu = 1/N \end{gather}\]

The full time and frequency grids \(t_m\) and \(\nu_n\) may then be constructed using the array indices \(m\) and \(n\) ranging from \(0\) to \(N-1\). The frequency domain may have an optional offset \(\nu_0\):

\[\begin{gather} t_m = (m - \lfloor N/2 \rfloor) \, dt \qquad \nu_n = \nu_0 + (n - \lfloor N/2 \rfloor) \, d\nu \end{gather}\]

If planning to transform between the analytic and real-valued representations, \(\nu_0\) must be integer divisible by \(d\nu\) and \(\nu_n\) should be greater than \(0\) at all points.

Real-Valued Representation#

The coordinate grids for the associated real-valued representation \({t_r}_m\) and \({\nu_r}_n\) use array index \(m\) ranging from \(0\) to \(N_r-1\) and array index \(n\) ranging from \(0\) to \(\lfloor N_r/2 \rfloor\). Choose the total number of points \(N_r\) to allow transforming from the analytic representation without aliasing:

\[\begin{split}\begin{gather} dt_r \, d\nu = 1/N_r \\ {t_r}_m = (m - \lfloor N_r/2 \rfloor) \, dt_r \qquad {\nu_r}_n = n \, d\nu \end{gather}\end{split}\]

Array Ordering#

There are two alternate paths that ensure fft and ifft functions always receive the correct ordering and that the ordering of the coordinate grids and amplitude arrays are always aligned. The first is to order all arrays such that the coordinate grids are in a monotonic order and then wrap calls to fft or ifft with ifftshift and fftshift operations. The second is to order all arrays in fft order and then only use fftshift operations when one wants to display arrays with monotonically ordered coordinate arrays.

Monotonic Order:#
  • Keep the time and frequency grids as defined above.

  • Construct amplitude arrays \(a\left[t\right]_m\) and \(A\left[\nu\right]_n\) using the monotonic order of the coordinate arrays.

  • Transform between the frequency-domain analytic and real-valued representations using the monotonic order of the coordinate arrays:

    \[\begin{split}\begin{gather} F\left[\nu_r\right]_n = \begin{cases} \frac{1}{\sqrt{2}} A\left[\nu_r\right]_n &\text{if ${\nu_r}_n \in \nu$} \\ 0 &\text{all other cases} \end{cases} \end{gather}\end{split}\]
  • Nest all calls to fft and ifft between fftshift and ifftshift. Include normalization factors \(dt\) and \(N d\nu\):

    \[\begin{split}\begin{alignat}{4} &\text{ifft:} & a\left[t\right]_m &= \operatorname{fftshift}\!\left(\operatorname{ifft}\!\left(\operatorname{ifftshift}\!\left( A\!\left[\nu\right] N d\nu \right)\right)\right)_m \\ &\text{fft:} & A\left[\nu\right]_n &= \operatorname{fftshift}\!\left(\operatorname{fft}\!\left(\operatorname{ifftshift}\!\left( a\!\left[t\right] dt \right)\right)\right)_n \\ &\text{irfft:} & f\left[t_r\right]_m &= \operatorname{fftshift}\!\left(\operatorname{irfft}\!\left( F\!\left[\nu_r\right] N_r d\nu , \quad n=N_r\right)\right)_m \\ &\text{rfft:} & F\left[\nu_r\right]_n &= \operatorname{rfft}\!\left(\operatorname{ifftshift}\!\left( f\!\left[t_r\right] dt_r \right)\right)_n \end{alignat}\end{split}\]
  • Display the coordinate and amplitude arrays without any other modification.

FFT Order:#
  • Store the time and frequency grids in standard fft order:

    \[\begin{split}\begin{align} t_m &= \operatorname{ifftshift}\!\left(t\right)_m & \nu_n &= \operatorname{ifftshift}\!\left(\nu\right)_n \\ {t_r}_m &= \operatorname{ifftshift}\!\left(t_r\right)_m & {\nu_r}_n &= \text{as defined above} \end{align}\end{split}\]
  • Construct amplitude arrays \(a\left[t\right]_m\) and \(A\left[\nu\right]_n\) using the fft order of the coordinate arrays.

  • Transform between the frequency-domain analytic and real-valued representations after an fftshift operation on the analytic array:

    \[\begin{split}\begin{equation} F\left[\nu_r\right]_n = \begin{cases} \frac{1}{\sqrt{2}} \operatorname{fftshift}\!\left(A\!\left[\nu_r\right]\right)_n &\text{if ${\nu_r}_n \in \nu$} \\ 0 &\text{all other cases} \end{cases} \end{equation}\end{split}\]
  • Call fft and ifft without any fftshift or ifftshift. Include normalization factors \(dt\) and \(N d\nu\):

    \[\begin{split}\begin{alignat}{4} &\text{ifft:} & a\left[t\right]_m &= \operatorname{ifft}\!\left( A\!\left[\nu\right] N d\nu \right)_m \\ &\text{fft:} & A\left[\nu\right]_n &= \operatorname{fft}\!\left( a\!\left[t\right] dt \right)_n \\ &\text{irfft:} & f\left[t_r\right]_m &= \operatorname{irfft}\!\left( F\!\left[\nu_r\right] N_r d\nu, \quad n=N_r\right)_m \\ &\text{rfft:} & F\left[\nu_r\right]_n &= \operatorname{rfft}\!\left( f\!\left[t_r\right] dt_r \right)_n \end{alignat}\end{split}\]
  • Display the coordinate and amplitude arrays after applying fftshift.