Real/Inverse Real FFT Operations When Array Length is Not a Power of 2 (2^N)Primary Software: LabVIEW Development Systems>>Full Development System Primary Software Version: 5.0.1 Primary Software Fixed Version: N/A Secondary Software: N/A
Problem: I am correcting small phase errors in my spectra data (1D array, 2048 points) with the following steps:
However, if I deliberately force DFT by, for example, clipping off the last point such that the array is now only 2047 points, the procedure does not work. The spectrum shape remains the same and only the amplitude changes. Why does this procedure seems to only work for arrays with 2^N points? Solution: You use the Real FFT VI to find the Fourier Transform of a real valued signal. The output of this operation is a complex valued spectrum. You then compute the polar components of the complex valued spectrum and change the phase of the spectrum. Finally, you convert the spectrum back to the complex number domain and use the Inverse Real FFT VI to restore the original signal from the complex domain. This last step is where a fundamental mistake is being made. By changing the phase of the original signal's spectrum, you are actually changing the original signal significantly. Therefore the original signal is no longer real, but is complex valued. So it is more appropriate to use the Inverse Complex FFT VI, instead of the Inverse Real FFT VI, to reconstruct the signal from the spectrum. To illustrate this, please see the attached FFTvsDFT(Modified) VI and contrast it with the attached FFTvsDFT VI. In the FFTvsDFT(Modified) VI, we can see both the real and imaginary parts of the time signal obtained from the spectrum whose phase had been modified. And now it does not matter if the number of points is a power of 2 or not. Even if you shift from 2048 to 2047 to 2046 points, the results do not change drastically. This brings us to the next point, why were the results different previously when we used the Inverse Real FFT VI and changed the number of data points from 2048 to 2047? The Fourier Transform of a real valued signal is complex valued and symmetric. When the number of data points is equal to 2048, the Inverse Real FFT computes the inverse FFT by applying the fast radix2 FFT algorithm. This algorithm assumes that the output time domain signal is real; therefore the input spectrum is symmetric. So it assumes this property of symmetry. When the number of data points is not a power of 2 (for example, 2047), the Inverse Real FFT does a DFT using the Chirp Z algorithm. In this case, the algorithm does not assume anything about the symmetry of the input spectrum, so the results are different. Note: In LabVIEW 7.1 and later, the Real FFT VI is a polymorphic instance VI of the FFT VI and the Inverse Real FFT VI is a polymorphic instance of the Inverse FFT VI. Related Links: KnowledgeBase 3EO84SLO: How Does the LabVIEW FFT Deal with Data When the Number of Samples is Not a Power of 2? Attachments:
Report Date: 04/16/1998 Last Updated: 08/19/2008 Document ID: 18FFLL4N
