Applying Inverse Fourier Transform In Python Using Numpy.fft

The inverse of Discrete Time Fourier Transform provides transformation of the signal back to the time domain representation from frequency domain representation. The Python example uses the numpy.fft.ifft() function to transform a signal with multiple frequencies back into time domain.

Signals Updated 16 Mar 2019 1 min read

Overview

  • While the Discrete Time Fourier Transform transforms a signal from time domainto frequency domain, the inverse Discrete Time Fourier Transform takes the representation of the signal back to the time domain.
  • The inverse of Discrete Time Fourier Transform - DTFT is called as the inverse DTFT.
  • The Python module numpy.fft has a function ifft() which does the inverse transformation of the DTFT.
  • The Python example uses a sine wave with multiple frequencies 1 Hertz, 2 Hertz and 4 Hertz. The signal is plotted using the numpy.fft.ifft() function.

Example

python
import numpy as np

import matplotlib.pyplot as plt

# Time period

t = np.arange(0, 10, 0.01);

# Create a sine wave with multiple frequencies(1 Hz, 2 Hz and 4 Hz)

a = np.sin(2*np.pi*t) + np.sin(2*2*np.pi*t) + np.sin(4*2*np.pi*t);

# Do a Fourier transform on the signal

tx  = np.fft.fft(a);

# Do an inverse Fourier transform on the signal

itx = np.fft.ifft(tx);

# Plot the original sine wave using inverse Fourier transform

plt.plot(t, a);

plt.title("Sine wave plotted using inverse Fourier transform");

plt.xlabel('Time')

plt.ylabel('Amplitude')

plt.grid(True)

plt.show();

Output

Sine wave plotted using the Inverse Fourier Transform