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
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | >>> 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]) >>> |
Parent topic: Fourier Transform Functions