scipy.fftpack provides ifft function to calculate Inverse Discrete Fourier Transform on an array. In this tutorial, we shall learn the syntax and the usage of ifft function with SciPy IFFT Examples.


y = scipy.fftpack.ifft(x, n=None, axis=-1, overwrite_x=False)
Parameter Required/ Optional[datatype] Description
xRequired[array] Array on which IFFT has to be calculated.
nOptional[int] Length of the Fourier transform. If n < x.shape[axis], x is truncated. If n > x.shape[axis], x is zero-padded. The default results in n = x.shape[axis].
axisOptional[int] Axis along which the fft’s are computed; the default is over the last axis (i.e., axis=-1).
overwrite_xOptional[boolean] If True, the contents of x can be destroyed; the default is False.
y[Returned value][complex ndarray] Inverse Discrete Fourier Transform of x.

Values provided for the optional arguments are default values.

SciPy IFFT Example

# import numpy
import numpy as np

# import fft
from scipy.fftpack import fft, ifft

# numpy array
x = np.array([1.0, 2.0, 1.0, 2.0, -1.0])
print("x            : ",x)

# apply fft function on array
y = fft(x)
print("fft(x)       : ",y)

# ifft (y)
z = ifft(y)
print("ifft(fft(x)) : ",z)
Try Online


x            :  [ 1.  2.  1.  2. -1.]
fft(x)       :  [ 5.00000000+0.j         -1.11803399-2.2653843j   1.11803399-2.71441227j
  1.11803399+2.71441227j -1.11803399+2.2653843j ]
ifft(fft(x)) :  [ 1.+0.j  2.+0.j  1.+0.j  2.+0.j -1.+0.j]