<< Chapter < Page | Chapter >> Page > |
The complexToComplex method can be used to perform either a forward or an inverse transform. The value of the first parameter determineswhether the method performs a forward or an inverse Fourier transform.
A value of +1 for the first parameter causes the complexToComplex method to perform a forward Fourier transform.
A value of -1 for the first parameter causes the complexToComplex method to perform an inverse Fourier transform.
Although I didn't include the code in this module, (because it was shown in an earlier module) , the transform method in Figure 7 passes a value of +1 to the complexToComplex method to cause it to perform a forward Fourier transform.
Similarly, the inverseTransform method shown in Listing 17 passes a value of -1 to the complexToComplex method to cause it to perform an inverse Fourier transform.
As evidenced in Figure 1 and Figure 2 , the program named Dsp035 , which uses a DFT algorithm, produces the same results as the program named Dsp036 , which uses an FFT algorithm. However, if you were to put a timer on each of the programs, you would find that Dsp036 runs faster due to the improved speed of the FFT algorithm over the DFTalgorithm.
The program named Dsp037 illustrates frequency filtering accomplished by modifying the complex spectrum in the frequency domain and thenperforming an inverse Fourier transform on the modified frequency-domain data. The results are shown in Figure 4 .
Figure 4. Filtering in the frequency domain. |
---|
The program begins by using an FFT algorithm to perform a forward Fourier transform on a single impulse in the time domain.
(A DFT algorithm could have been used equally as well, but it would have been slower.)
The impulse is shown as the input time series in the topmost plot in Figure 4 .
(Although I didn't show the complex spectrum of the impulse, we know that the magnitude of the spectrum of an impulse is constant across allfrequencies. In other words, the magnitude spectrum of an impulse is a flat line from zero to the sampling frequency and above.)
Then the program eliminates all energy between one-sixth and five-sixths of the sampling frequency by setting the real and imaginary parts of the FFT outputto zero.
The second, third, and fourth plots in Figure 4 show the real part, imaginary part, and amplitude respectively of the modified complex spectrum.
(The two boxes in the fourth plot in Figure 4 show what's left of the spectral energy after the energy in the middle of the band has beeneliminated.)
The folding frequency in these three plots is near the center of the plot at the eighth tick mark.
The input data length was 256 samples. All but one of the input data values was set to zero resulting in a single impulse in the input time series near thesecond tick mark in Figure 4 .
Notification Switch
Would you like to follow the 'Digital signal processing - dsp' conversation and receive update notifications?