Rate This Document
Findability
Accuracy
Completeness
Readability

fft.fft

Description

Compute the one-dimensional 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
>>> 
>>> np.fft.fft(ts)
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])
>>>