All formulas

Signal processing

Discrete Fourier transform

signal.dftAlso called dft, fft, fourier transform, discrete fourier transform

Xk=∑n=0N−1xn e−2πikn/NX_{k} = \sum_{n=0}^{N - 1} x_{n}\, e^{-2\pi i k n / N}

The N complex Fourier coefficients of N samples, unnormalized, with the negative exponent in the forward direction. The inverse is xn = (1/N) Σ Xk e2πikn/N; the fast Fourier transform computes the same values in O(N log N) operations.

Notation

xx

the samples x0 … xN−1

x ∈ ℝN

NN

number of samples

Size, at least 1

XX

Result: the Fourier coefficients X0 … XN−1

vector

Worked examples

Each result is solved exactly and confirmed by two independent computations.

  1. Given

    x=[1,2,3,4]x = [1, 2, 3, 4]

    Result

    X=(10,−2+2i,−2,−2−2i)\displaystyle X = \left(10, -2 + 2 i, -2, -2 - 2 i\right)
  2. Given

    x=[1,0,0,0]x = [1, 0, 0, 0]

    Result

    X=(1,1,1,1)\displaystyle X = \left(1, 1, 1, 1\right)
  3. Given

    x=[0,1,0,−1]x = [0, 1, 0, -1]

    Result

    X=(0,−2i,0,2i)\displaystyle X = \left(0, - 2 i, 0, 2 i\right)
  4. Given

    x=[1,1,1]x = [1, 1, 1]

    Result

    X=(3,0,0)\displaystyle X = \left(3, 0, 0\right)

Common mistakes

  • Uses the positive exponent

    e+2πikn/N is the inverse transform without its 1/N; for real input every coefficient comes out as the complex conjugate of the right one.

    Fix: Use e−2πikn/N in the forward transform.

  • Divides the forward transform by N

    Every coefficient is 1/N of the unnormalized value; that convention moves the 1/N from the inverse into the forward transform.

    Fix: Leave the forward sum unscaled and put 1/N on the inverse, or state the convention.

Source

  • Cooley and Tukey 1965

    Cooley, James W.; Tukey, John W. An Algorithm for the Machine Calculation of Complex Fourier Series. Mathematics of Computation 19(90): 297-301, 1965. doi:10.1090/S0025-5718-1965-0178586-1

    doi.org