0
$\begingroup$

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()
$\endgroup$
  • 2
    $\begingroup$ Does this answer your question? Fourier transform 4 times = original function (from Bracewell book) $\endgroup$ – Matt L. Dec 22 '19 at 13:28
  • $\begingroup$ As for your code, shouldn't k be in (0,N-1)? $\endgroup$ – Matt L. Dec 22 '19 at 13:37
  • $\begingroup$ @MattL. I tried with swapping k and n, but it's actually worse $\endgroup$ – C. Cristi Dec 22 '19 at 17:44
  • $\begingroup$ Why swapping? k should go from 0 to N-1, not to N. $\endgroup$ – Matt L. Dec 22 '19 at 18:18
0
$\begingroup$

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.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.