Admin Production ni-theme
Current Publication

CxFFTEx

LabWindows/CVI

CxFFTEx

Advanced Analysis Library Only

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

Purpose

Calculates the 1D Fast Fourier Transform (FFT) of a complex time-domain signal. National Instruments recommends you use CxFFTEx instead of FFT. CxFFTEx includes additional parameters, which makes it more versatile than FFT. 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 CxFFTEx with a reusable FFT table.

If you perform the same size FFT repeatedly, you can use CreateFFTTable to create the FFT table and then pass the table you created to CxFFTEx to speed up the computation. If you pass NULL for fftTable, the function creates the table internally and frees the table when it returns.

The following pseudocode demonstrates calling FFT routines:

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

Parameters

Input
Name Type Description
timeDomainSignal NIComplexNumber [] The complex 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 zeros to match numberOfElementsForFFT. If numberOfElementsForFFT is smaller than numberOfElements, only the first numberOfElementsForFFT elements are used. If numberOfElementsForFFT is less than 1, this function uses numberOfElements as numberOfElementsForFFT.
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 fft. 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.
Output
Name Type Description
FFT NIComplexNumber [] The 1D FFT of the complex 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