# nlcpy.fft.ifft

nlcpy.fft.ifft(a, n=None, axis=- 1, norm=None)[ソース]

Computes the one-dimensional inverse discrete fourier transform.

This function computes the inverse of the one-dimensional n-point discrete fourier transform computed by fft(). In other words, ifft( fft(a) ) == a to within numerical accuracy. The input should be ordered in the same way as is returned by fft(), i.e.,

• a should contain the zero frequency term,

• a[1:n//2] should contain the positive-frequency terms,

• a[n//2 + 1:] should contain the negative-frequency terms, in increasing order starting from the most negative frequency.

For an even number of input points, A[n//2] represents the sum of the values at the positive and negative Nyquist frequencies, as the two are aliased together.

Parameters
aarray_like

Input array, can be complex.

nint,optional

Length of the transformed axis of the output. If n is smaller than the length of the input, the input is cropped. If it is larger, the input is padded with zeros. If n is not given, the length of the input along the axis specified by axis is used. See notes about padding issues.

axisint,optional

Axis over which to compute the inverse DFT. If not given, the last axis is used. If axis is larger than the last axis of a, IndexError occurs.

norm{None, "ortho"},optional

Normalization mode. By default(None), the transforms are scaled by . It norm is set to "ortho", the return values will be scaled by .

Returns
outcomplex ndarray

The truncated or zero-padded input, transformed along the axis indicated by axis, or the last one if axis is not specified.

fft

Computes the one-dimensional discrete fourier transform.

ifft2

Computes the 2-dimensional inverse discrete fourier transform.

ifftn

Computes the n-dimensional inverse discrete fourier transform.

If the input parameter n is larger than the size of the input, the input is padded by appending zeros at the end. Even though this is the common approach, it might lead to surprising results. If a different padding is desired, it must be performed before calling ifft.

Examples

>>> import nlcpy as vp
>>> vp.fft.ifft([0, 4, 0, 0])
array([ 1.+0.j,  0.+1.j, -1.+0.j,  0.-1.j])


Create and plot a band-limited signal with random phases:

>>> import matplotlib.pyplot as plt
>>> t = vp.arange(400)
>>> n = vp.zeros((400,), dtype=complex)
>>> n[40:60] = vp.exp(1j*vp.random.uniform(0, 2*vp.pi, (20,)))
>>> s = vp.fft.ifft(n)
>>> _ = plt.plot(t, s.real, 'b-', t, s.imag, 'r--')
>>> _ = plt.legend(('real', 'imaginary'))
>>> plt.show()