DMelt:DSP/2 Discrete Fourier Transform

From HandWiki
Member


Discrete Fourier Transform (DFT)

The Discrete Fourier Transform (DFT) is a numerical variant of the Fourier Transform. Read Discrete Fourier transform. A discrete fourier transform 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]