Function fft

  • Calculates the Fast Fourier Transform (FFT) of a sequence.

    Parameters

    • sequence: number[]

      The input sequence for which to calculate the FFT.

    Returns ComplexNumber[]

    An array of complex numbers representing the FFT coefficients.

    Remark

    This is only defined for sequences of numbers at the moment it is a basic implementation and i plan on improving it in the future

    Example

    const sequence = [1, 2, 3, 2];
    const result = fft(sequence);
    console.log(result);
    // Output:
    [
    { real: 8, imaginary: 0 },
    { real: -1.2246467991473532e-16, imaginary: 2 },
    { real: 0, imaginary: 0 },
    { real: -1.2246467991473532e-16, imaginary: 2 }
    ]

Generated using TypeDoc