Inverse FFT helps us change data from frequency back to time or space. It is useful to understand original signals after analyzing their frequencies.
Inverse FFT (ifft) in SciPy
scipy.fft.ifft(x, n=None, axis=-1, norm=None, overwrite_x=False, workers=None, plan=None)
x is the input array in frequency domain.
n is the length of the output. If not given, it matches input length.
from scipy.fft import ifft x = [1, 2, 3, 4] time_signal = ifft(x)
import numpy as np from scipy.fft import ifft x = np.array([1+0j, 0+1j, -1+0j, 0-1j]) time_signal = ifft(x)
from scipy.fft import ifft x = [1, 2, 3, 4] time_signal = ifft(x, n=8)
This program shows how to convert time data to frequency data using FFT, then back to time data using inverse FFT. The recovered data is complex due to computation but the real part matches the original.
from scipy.fft import fft, ifft import numpy as np # Original time data: a simple wave time_data = np.array([1, 2, 3, 4]) # Convert to frequency domain freq_data = fft(time_data) # Convert back to time domain using inverse FFT recovered_time_data = ifft(freq_data) print("Original time data:", time_data) print("Frequency data:", freq_data) print("Recovered time data (complex):", recovered_time_data) print("Recovered time data (real part):", recovered_time_data.real)
The output of ifft is complex even if input is real. Usually, the imaginary part is very close to zero and can be ignored.
Use .real to get the real part of the inverse FFT result if you expect real signals.
Inverse FFT length n can be different from input length to pad or truncate the signal.
Inverse FFT changes frequency data back to original time or space data.
Output is complex; usually, the real part is the meaningful signal.
Useful to reconstruct signals after frequency analysis or filtering.