This blog post implements a Fast Fourier Transform (FFT) or an Inverse Fast Fourier Transform (IFFT) on a complex input, dependent on the checkbox setting below. You can specify the sampling frequency in arbitrary units (e.g. Hz) in the appropriately labelled text area below (a default of 100 is used).

For discrete time-domain input samples \(x[n]\) for \(n={0,1,2,..,N-1}\) the FFT (at bin \(k\) for \(k={0,1,2,..,N-1})\) is defined by equation

\(X[k]=\sum_{n=0}^{N-1}x[n]exp(-j2\pi\frac{nk}{N})\)

while for discrete frequency-domain input bins \(X[k]\) for \(k={0,1,2,..,N-1}\) the IFFT (at time index \(n\) for \(n={0,1,2,..,N-1}\)) is defined by equation

\(x[n]=\frac{1}{N}\sum_{k=0}^{N-1}X[k]exp(+j2\pi\frac{nk}{N})\)

where \(N=2^g\) for integer \(g\).

Please enter the numbers in the text areas below - one number per line, for each of the Real and Imaginary input textareas (the textareas have already been filled in with some numbers for illustration purposes). There must be no new line after the last number.

Note that if the input is real only, the imaginary input textarea can be left empty (rather than having to fill it with the same number of zeros as there are real inputs, which can be a bit more cumbersome). Conversely, if the input is imaginary only, the real input textarea can be left empty (rather than having to fill it with the same number of zeros as there are imaginary inputs).

Alternatively you can choose to load a CSV file, which must be either a single column of numbers (for a real only input) or two comma-separated columns of numbers - the first line can be a comment line, starting with the character #.

To perform the FFT/IFFT, please press the button labelled "Perform FFT/IFFT" below - the results will populate the textareas below labelled "Real Output" and "Imaginary Output", as well as a textarea at the bottom that will contain the real and imaginary output joined using a comma - this is suitable for copying and pasting the results to a CSV file.

In addition, graphical outputs of the FFT are displayed below. These include a graph of FFT magnitude (using the drop-down menu below, you can select the units of this parameter) and a graph of the phase response (units of either radian or degrees also selectable by a drop-down menu below). When a unit is altered, you would need to perform the FFT again by pressing the calculate button for the changes to take effect.

At the bottom of this blog post, the Decimation In Time (DIT) twiddle Q factors will be displayed, as defined in https://www.dsprelated.com/showarticle/107.php. For an $N$ point FFT, there are $log_2(N)$ stages, and for each stage there are $N/2$ twiddle factors that do not equal the $-1$ term - these are the ones that will be printed.

If you change inputs to a smaller number of samples, please press the calculate button twice for the results to take effect. Alternatively, you can simply reload the page, then fill in the input textareas.

As the FFT operates on inputs that contain an integer power of two number of samples, the input data length will be augmented by zero padding the real and imaginary data samples to satisfy this condition were this not to hold.

You can find an FFT based Power Spectral Density (PSD) Estimator here.

Sampling frequency:-

FFT size...

Real and Imaginary output concatenated on each line:-

FFT Magnitude | ||

Complex (Linear) |
||

Frequency |
||

Complex (Linear) |
||

Frequency |

FFT Phase Response | ||

Radians |
||

Frequency |
||

Radians |
||

Frequency |

FFT twiddle factors...