Advanced Analysis Library Only

AnalysisLibErrType FFTEx (double timeDomainSignal[], ssize_t numberOfElements, ssize_t numberOfElementsForFFT, PFFTTable fftTable, int shift, NIComplexNumber fft[]);


Computes the Fast Fourier Transform (FFT) of a real time-domain signal. National Instruments recommends that you use this function instead of ReFFT. FFTEx includes additional parameters, which makes it more versatile than ReFFT. For example, you can specify the number of elements for the FFT, which can be less or greater than the number of elements in the time-domain signal. You also can use FFTEx with a reusable FFT table, which can speed up computation.

If you want to perform the same size FFT repeatedly, you can use CreateFFTTable to create an FFT table and then pass this table to FFTEx. If you pass NULL for fftTable, FFTEx creates the table internally and frees the table on exit.

The following code is the pseudocode for calling FFT routines:

            N=1024; //Set length of signal
            tbl=CreateFFTTable(N);  //Create N-point table
                Acquire_N_Point_Signal(signal); //Acquire N points
                FFT(signal,..., tbl,...);       //Perform FFT
            DestroyFFTTable(tbl);       //End, release FFT table resources


Name Type Description
timeDomainSignal double [] The real time-domain signal.
numberOfElements ssize_t The number of elements in timeDomainSignal.
numberOfElementsForFFT ssize_t The desired FFT size. If numberOfElementsForFFT is greater than numberOfElements, this function pads timeDomainSignal with trailing zeros to get a time-domain signal that has numberOfElementsForFFT elements. If numberOfElementsForFFT is smaller than numberOfElements, this function truncates timeDomainSignal. If numberOfElementsForFFT is less than 1, this function uses numberOfElements for this parameter.
FFTTable PFFTTable The FFT table created using CreateFFTTable. You can pass NULL for this parameter if you do not have a reusable FFT table.
shift int Specifies whether to shift the DC component to the center of the FFT result. shift must be one of the following values:
  • FALSE (0): Ordinary FFT. The first element of fft is the DC component.
  • TRUE (1): DC-centered FFT. The first element of fft is the -PI frequency element. The floor(numberOfElementsForFFT / 2)-th element of fft is the DC component.
Name Type Description
FFT NIComplexNumber [] The FFT of the time-domain signal.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.

Additional Information

Library: Advanced Analysis Library

Include file: analysis.h

LabWindows/CVI compatibility: LabWindows/CVI 8.0 and later


Refer to analysis\narrowbandfilter.cws for an example of using the FFTEx function.

Open example


Not Helpful