1

I was wondering what really happens when taking the inverse discrete FFT on some set of numbers, for 3 times? Because looking at it, it looks like we're getting an output that is identically with the input, and I don't get why.

Also I was trying to implement my own inverse discrete Fourier transform in python, following wikipedia, looking at the IFFT provided by octave:

and at the plot provided by my code:

It just doesn't make any sense. Here is my code:

#!/usr/bin/python
import matplotlib.pyplot as plt
import numpy as np
import math

points = [24+0j, -18.39230+0.73205j, 8-3.46410j, 
        -2+4j, 0+0j, 2.39230-2.73205j, -4+0j, 2.39230+2.73205j, 0-0j, 
        -2-4j, 8+3.46410j, -18.39230-0.73205j]

def inverse_fourier_transform(points):
    inversed_points = []
    N = len(points)

    for k in range(0, N):
        s = 0.0
        for n in range(0, N - 1):
            s += points[n]*np.exp(1.j*2.0*np.pi*k*n/N)/N 
        inversed_points.append(s)

    return inversed_points

inv_points = inverse_fourier_transform(points)
inv_points2 = inverse_fourier_transform(inv_points)
inv_points3 = inverse_fourier_transform(inv_points2)

x = []
y = []

for pt in inv_points3:
    x.append(pt.real)
    y.append(pt.imag)

plt.scatter(x, y, s=0.5)
plt.plot(x, y)
plt.show()
C. Cristi
  • 111
  • 2

1 Answers1

1

The FFT and IFFT are almost identical operation: other than scaling (depending on convention) and complex conjugation they are the same.

Ignoring the scaling (or assuming $1/\sqrt N$). We have

  1. Apply one time: spectrum
  2. Apply second time: time inverse original
  3. Apply third time: conjugate spectrum
  4. Apply 4th time: original signal

For inverse inverse FFT: reverse the order of the steps.

Hilmar
  • 44,604
  • 1
  • 32
  • 63