You are here: Symbol Reference > MtxExpr Namespace > Classes > Vector Record > public > FFTFromReal Method > Vector.FFTFromReal Method ()
MtxVec VCL
ContentsIndex
PreviousUpNext
Vector.FFTFromReal Method ()

The forward Fast Fourier Transformation (FFT) from real to complex.

Pascal
function FFTFromReal: TVec; overload;

Calculates the forward Fast Fourier Transformation (FFT) from real to complex for the calling vector in-place. The transform should be used, when the conjugate symmetric part of the frequency spectrum is not desired. If the calling vector is complex an exception will be raised. The operation implicitly sets the calling vector Complex property to True. The highest performance will be achieved if the transform length will be a power of two. The transform length is equal to Length, when the FFTStorageFormat is fsfPack or fsfPerm. The default storage format is fsfCCS. 

In-place fsfCCS complication 

The transform length in case of fsfCCS will be equal to Length-2, because the result is bigger than the source data by 2 real samples, if the source data is even. If the source data length is odd, then FFTOddLength must be set to True and only Length-1 samples will be used, but Length must of course in that case be even, or Length-1 will not be odd. The last two (one) samples in the vector will be ignored and will be overwritten with the result.

var a,b: Vector; begin //Even a.SetIt(false,[1,2,3,4]); b.FFTFromReal(a); // b = [(10, 0),( -2,2), (-2, 0)] a.SetIt(false,[1,2,3,4, 0, 0]); //result requires 3 complex (or 6 real values) a.FFTFromReal; // b = [(10, 0),( -2,2), (-2, 0)] //Odd length a.SetIt(false,[1,2,3]); b.FFTOddLength := True; //use only Length-1 samples b.FFTFromReal(a); // b = [(6,0),( -1.5,0.8660)] //result requires 2 complex (= 4 real numbers) a.SetIt(false,[1,2,3,0]); a.FFTOddLength := True; //use only Length-1 samples a.FFTFromReal; // b = [(6,0),( -1.5,0.8660)] //result requires 2 complex (= 4 real numbers) end;
Examples on GitHub
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!