Rate This Document
Findability
Accuracy
Completeness
Readability

fft.ifft

Description

Compute the one-dimensional inverse discrete Fourier Transform.

Mandatory Input Parameters

Parameter

Type

Description

a

array_like

Input array, which can be a complex number

Optional Input Parameters

Parameter

Type

Default Value

Description

n

int

None

Length of the transformed axis of the output.

  • If n is less than the input length, the input is cropped.
  • If n is greater than the input length, the input is padded with zeros.
  • If n is not given, the length of the input along the axis specified by axis is used.

axis

int

-1

Axis over which to compute the FFT. If not given, the last axis is used.

norm

{"backward", "ortho", "forward"}

backward

Normalization mode (see numpy.fft). It indicates which direction of the forward/backward pair of transforms is scaled and with what normalization factor.

Return Value

Type

Description

ndarray

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

Examples

>>> import numpy as np
>>> t = np.arange(12)
>>> ts = np.sin(t)
>>> ts
array([ 0.        ,  0.84147098,  0.90929743,  0.14112001, -0.7568025 ,
       -0.95892427, -0.2794155 ,  0.6569866 ,  0.98935825,  0.41211849,
       -0.54402111, -0.99999021])
>>> 
>>> np.sum(ts)
0.41119816466730696
>>> 
>>> fts = np.fft.fft(ts)
>>> fts
array([ 0.41119816+0.00000000e+00j,  0.46997981+4.11832106e-01j,
       -1.36179847-5.76500237e+00j,  0.14669493-4.96548795e-01j,
        0.20513541-2.23341703e-01j,  0.22157176-9.53854700e-02j,
        0.22563497+4.44089210e-16j,  0.22157176+9.53854700e-02j,
        0.20513541+2.23341703e-01j,  0.14669493+4.96548795e-01j,
       -1.36179847+5.76500237e+00j,  0.46997981-4.11832106e-01j])
>>>
>>> np.fft.ifft(fts)
array([ 1.85037171e-17+1.06396373e-16j,  8.41470985e-01-3.46944695e-17j,
        9.09297427e-01+7.86407976e-17j,  1.41120008e-01-3.93203988e-17j,
       -7.56802495e-01+3.38641526e-18j, -9.58924275e-01-3.46944695e-17j,
       -2.79415498e-01-4.09691099e-17j,  6.56986599e-01-3.93203988e-17j,
        9.89358247e-01-1.26382738e-17j,  4.12118485e-01-3.46944695e-17j,
       -5.44021111e-01+8.72284026e-17j, -9.99990207e-01-3.93203988e-17j])
>>>