scipy.fftpack.irfft#
- scipy.fftpack.irfft(x, n=None, axis=- 1, overwrite_x=False)[source]#
Return inverse discrete Fourier transform of real sequence x.
The contents of x are interpreted as the output of the
rfft
function.- Parameters
- xarray_like
Transformed data to invert.
- nint, optional
Length of the inverse 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].
- axisint, optional
Axis along which the ifft’s are computed; the default is over the last axis (i.e., axis=-1).
- overwrite_xbool, optional
If True, the contents of x can be destroyed; the default is False.
- Returns
- irfftndarray of floats
The inverse discrete Fourier transform.
See also
Notes
The returned real array contains:
[y(0),y(1),...,y(n-1)]
where for n is even:
y(j) = 1/n (sum[k=1..n/2-1] (x[2*k-1]+sqrt(-1)*x[2*k]) * exp(sqrt(-1)*j*k* 2*pi/n) + c.c. + x[0] + (-1)**(j) x[n-1])
and for n is odd:
y(j) = 1/n (sum[k=1..(n-1)/2] (x[2*k-1]+sqrt(-1)*x[2*k]) * exp(sqrt(-1)*j*k* 2*pi/n) + c.c. + x[0])
c.c. denotes complex conjugate of preceding expression.
For details on input parameters, see
rfft
.To process (conjugate-symmetric) frequency-domain data with a complex datatype, consider using the newer function
scipy.fft.irfft
.Examples
>>> from scipy.fftpack import rfft, irfft >>> a = [1.0, 2.0, 3.0, 4.0, 5.0] >>> irfft(a) array([ 2.6 , -3.16405192, 1.24398433, -1.14955713, 1.46962473]) >>> irfft(rfft(a)) array([1., 2., 3., 4., 5.])