fft
Fast Fourier transform.
| Library |
|
Syntax
Function call
-
Y = fft(X)— calculates the Discrete Fourier transform (DFT) for the argumentXusing the Fast Fourier Transform (FFT) algorithm. ArgumentYhas the same size asX.-
If
X— vector, thenfft(X)returns the Fourier transform for this vector. -
If
X— the matrix, thenfft(X)examines the columns of the argumentXas vectors, and returns the Fourier transform for each column. -
If
X— a multidimensional array, thenfft(X)considers values based on the first dimension of the array, the size of which is not equal to1, as vectors, and returns the Fourier transform for each vector.
-
-
Y = fft(X,n)— returnsn-point DFT.-
If
X— vector and lengthXlessnThenXpadded with zeros up to the lengthn. -
If
X— vector and lengthXmorenThenXtruncated to lengthn. -
If
X— a matrix, then each column is treated as a vector. -
If
X— multidimensional array, the first dimension of the array, the size of which is not equal to1, is processed as a vector.
-
Arguments
Input arguments
# X — input array
+
vector | the matrix | multidimensional array
Details
An input array specified as a vector, matrix, or multidimensional array.
If X — an empty matrix of size 0 on 0 Then fft(X) returns an empty matrix of size 0 on 0.
| Data types |
|
| Support for complex numbers |
Yes |
# n is the length of the conversion
+
[] (default) | a non-negative integer scalar
Details
The length of the transformation, set as [] or a non-negative integer scalar. Specifying a positive integer for the conversion length can improve the performance of the function. fft. The length is usually specified as a power of two or a value that can be factorized (with prime factors of no more than 7). If n less than the length of the signal, the function fft ignores the remaining signal values after n-th element and returns a truncated result. If n equally 0, function fft returns an empty matrix.
| Data types |
|
# dim — the measurement for which the operation is performed
+
positive integer scalar
Details
The dimension that the operation is performed on is set as a positive integer. If no dimension is specified, the first dimension of the array is used by default, the size of which is not equal to 1.
If dim more ndims(X) Then fft(X,[],dim) returns X. If specified n, fft(X,n,dim) complements or truncates X up to length n by measurement dim.
| Data types |
|
Output arguments
# Y is a representation in the frequency domain
+
vector | the matrix | multidimensional array
Details
The representation in the frequency domain is returned as a vector, matrix, or multidimensional array.
If the argument is X has a type Float32, then the function fft it is calculated with single precision, and Y It also has a type Float32. Otherwise, Y returned as a type Float64.
Size of the argument Y It is defined as follows:
If X is a real number, then Y is conjugate symmetric, and the number of unique points in Y equally ceil((n+1)/2).
| Data types |
|
Recommendations
-
Lead time
fftdepends on the length of the conversion. Transformation lengths having only small prime factors (no more than7) provide significantly faster execution time than those that are simple numbers with large prime factors. -
For most values
nDFTs with real input data require about half as much computing time as DFTs with complex input data. However, with large prime factorsnThere is little or no difference in speed. -
You can potentially increase the speed
fftusing the utilityfftw. This function controls the optimization of the algorithm used to calculate the FFT of a given size and dimension.
List of literature
-
FFTW (https://www.fftw.org)
-
Frigo, M., and S. G. Johnson. «FFTW: An Adaptive Software Architecture for the FFT.» Proceedings of the International Conference on Acoustics, Speech, and Signal Processing. Vol. 3, 1998, pp. 1381–1384.