Documentation/Calc Functions/FOURIER

Function name:
FOURIER

Category:
Array

Summary:
Performs Fourier analysis of a data set by computing the Discrete Fourier Transform (DFT) of an input array of complex numbers, using Fast Fourier Transform (FFT) algorithms.

Syntax:
FOURIER(Array; Grouped By Columns [; Inverse [; Polar [; Minimum Magnitude]]])

Returns:
Returns an array containing a sequence of complex numbers that are the transformed values. The output array is a 2 × N or N × 2 cell range, where N is the number of complex numbers contained in the input array.

Arguments:
Array is a 2 × N or N × 2 cell range, containing an array of complex numbers to be transformed, where N is the length of the array. Array may be a specific cell range (for example, "$SourceData.A3:B12"), the name of a named or database range, or an inline array. If your input array comprises only real numbers, then a 1 × N or N × 1 cell range is accepted.

Grouped By Columns is a logical value (TRUE or FALSE), or a reference to a cell containing a logical value, that indicates whether Array is grouped by columns or rows. When TRUE (or any non-zero value), the array is grouped by columns where the first column contains the real parts of the complex numbers and the second column contains their imaginary parts. When FALSE (or 0), the first row contains the real parts of the complex numbers and the second row contains their imaginary parts. If there is only one column or row, the input sequence is treated as purely real. Inverse is a logical value (TRUE or FALSE), or a reference to a cell containing a logical value, that controls whether DFT or inverse DFT processing is required. When TRUE (or any non-zero value), FOURIER calculates the inverse DFT for the input array. When FALSE (or 0). FOURIER calculates the DFT. If Inverse is omitted, the default value is FALSE.

Polar is a logical value (TRUE or FALSE), or a reference to a cell containing a logical value, that controls whether the final output is in polar coordinates (magnitude and phase). When TRUE (or any non-zero value), FOURIER outputs data using polar coordinates. When FALSE (or 0), FOURIER outputs data using Cartesian coordinates. If Polar is omitted, the default value is FALSE.

Minimum Magnitude is a real number, or a reference to a cell containing a real number, that is only used if the Polar argument is set to TRUE. All frequency components with magnitude less than Minimum Magnitude will be suppressed with a zero magnitude-phase entry. This is very useful when looking at the magnitude-phase spectrum of a signal because there is always some very tiny amount of rounding error when doing FFT algorithms and results in incorrect non-zero phase for non-existent frequencies. By providing a suitable value to this parameter, these non-existent frequency components can be suppressed. If Minimum Magnitude is omitted, the default value is 0.0, so that no suppression is performed.

The following conditions may arise:
 * If Array encompasses more than one cell range, then FOURIER reports an invalid argument error (Err:502).
 * If Array includes any cells containing non-numeric data, then FOURIER reports a #VALUE! error.
 * If Grouped By Columns is non-numeric, then FOURIER reports a #VALUE! error.
 * If Grouped By Columns is TRUE (or a non-zero value) and Array contains more than two columns, then FOURIER reports an invalid argument error (Err:502).
 * If Grouped By Columns is FALSE (or 0) and Array contains more than two rows, then FOURIER reports an invalid argument error (Err:502).

Details specific to FOURIER function

 * The mathematics behind this function is beyond the scope of this wiki but more background information can be found at Wikipedia's Fourier analysis page and in the sources that it references.


 * For those with a technical interest in the algorithms used by the FOURIER function, a radix-2 decimation-in-time FFT is used when the length of the input sequence is an even power of 2, while Bluestein’s FFT algorithm is used when the length of the input sequence is not an even power of 2.

Examples:
The help page for the Fourier function provides a complex example. The following simple examples are intended to help understand the mechanics of using the function and do not represent real-world scenarios. The input data is assumed to be as shown in the following table.

The following examples are based on the above sample data.

Related LibreOffice functions:
None.

ODF standard:
None.

Equivalent Excel functions:
None.