FFT

Declaration: [1] FFT(var DataReal, DataImag: TDoubleArray; Weighting: TFastFourierWgtWin): integer;
[2] FFT2(var DataReal, DataImag: TDoubleArray; Weighting: TFastFourierWgtWin; param: double): integer;
Calculates the fast Fourier transform of the signal as stored in the array parameters DataReal and DataImag. The length of both arrays has to be a power of two. Before the transformation takes place the signal is weighted by a function specified by the parameter Weighting. Version [2] allows to pass a value in the parameter param which is interpreted as alpha of the Tukey window if Weighting = fwTukey, otherwise it is ignored. The valid range for alpha is 0...1 and is automatically confined to this range. For version [1] the Tukey alpha parameter is set internally to a value of 0.5.

The result of the transformation replaces the original data in the arrays DataReal and DataImag. The following figure clarifies the situation:

The function returns the following error codes:
 0 ... everything is OK
-1 ... the size of the data array is not a power of 2
-2 ... the real and imaginary parts are not of the same size

Hint: Please keep in mind to clear the imaginary part of the signal (DataImag) before performing the FFT of a measured signal. Otherwise old values from previous transformations may (and almost certainly will) create wrong results.