Discrete Fourier Transform (DFT)
- Snippet from Wikipedia: Discrete Fourier transform
In mathematics, the discrete Fourier transform (DFT) converts a finite list of equally spaced samples of a function into the list of coefficients of a finite combination of complex sinusoids, ordered by their frequencies, that has those same sample values.
A discrete fourier transform (DFT) algorithm is based on the jWave package. This is a simple example of transformation of 1D array:
from math.jwave import Transform from math.jwave.transforms import * t=Transform( DiscreteFourierTransform( ) ) arrTime = [1., 10., 12., 8., 1., 1., 1., 1. ] arrFreq = t.forward( arrTime ) # 1-D DFT forward print arrFreq.tolist() arrReco = t.reverse( arrFreq ) # 1-D DFT reverse print arrReco.tolist()
The output of this script is:
[3.75, 5.0, 1.75, -0.5, -2.7499, 0.4999, -1.750, 5.0] [1.0, 10.0, 12.0, 8.0, 1.0, 1.0, 1.0, 1.0]