Complex samplingAssume we want to get the spectrum of the output from a radio receiver that gives an audio signal in the range 300 to 3000 Hz. It would be reasonable to sample it at 8kHz if real valued sampling is used. Then an interference signal in the region 4 to 5kHz will be aliased above the spectrum range 300 to 3000Hz. Only signals that come out above 5kHz will cause false signals, and we can expect any reasonably well designed receiver to have a very good attenuation for such signals.
The centre frequency of the 300 to 3000 Hz pass band is 1650 Hz. Starting from a 6.6 kHz fixed frequency oscillator, it is easy to produce two 1650 square waves that are accurately phase shifted by 90 degrees. These two signals are used as the local oscillators of two frequency mixers that will mix the receiver output down to DC +/- 1350 kHz and form two different signals I and Q. (I for "in phase" and Q for "quadrature") In this way the real valued output 300 to 3000 Hz is converted to a complex valued 0 to 1350 Hz signal. The I and Q pair has to be low pass filtered in order to remove the sum frequencies 1950 to 4650 Hz. It is trivial to make low pass filters that are flat up to 1350Hz and attenuates by 40 dB above 2kHz. 2 kHz corresponds to 3650 kHz in the receiver output signal, and one may assume it is already attenuated by 20dB by the receiver itself.
The complex valued signal, the I and Q pair, can be sampled at 3.35 kHz. The sampled data then contain frequencies from 0 to 1675 Hz. In the region 1350 to 1675 Hz, the sampled data contains alias signals originating in signals between 1675 and 2000 Hz in the I, Q pair. These signals originate in signals between 3325 and 3650 Hz in the receiver output. The digital data in this frequency range is simply rejected. Any output from the receiver above 3650 Hz is attenuated by at least 40 dB by the I,Q low pass filters, so only very strong local stations may cause aliasing problems.
The complex valued signal comes at a data rate of 6700 samples per second as compared to 8000 for the real valued signal. The saving of 17% is partly because the region 0 to 300Hz that was present in the real valued data is not included in the complex valued data. The rest of the saving is from the extra anti alias filtering in the I and Q signals.
The big saving however comes from the use of FFT. The fast fourier transform is in itself complex valued. The output of the complex FFT contains positive and negative frequencies that correspond to frequencies above or below the oscillator producing the I, Q pair. 512 data pairs, sampled during 0.15 seconds, will produce a spectrum from -1350 to +1350 Hz, which is identical to the spectrum 300 to 3000 Hz in the receiver output signal. The 512 complex amplitudes cover the frequency range +/- 1675Hz in steps of 6.5Hz, but the ends may be impaired by aliasing signals and are omitted.
When the FFT is used for real data, the usual procedure is to put the real valued data in the I channel and make the Q channel zero. 1024 data points are sampled during 0.13 seconds and the FFT output will be 1024 complex amplitudes representing the frequencies -4000 to +4000Hz in steps of 7.8Hz. The negative frequencies contain the same information as the positive ones and are useless. It is trivial to pick the ones (positive or negative) that represent 300 to 3000 Hz for further processing.
The complex fourier transform will produce better resolution at less than half the work load for the DSP. The circuitry is slightly more complex, but by no means difficult. There is no difference in the final result. In the above example, the real valued FFT will produce identical output with 6.5Hz resolution if the data is sampled at 6.7 kHz, but then signals above 3.7kHz have to be well suppressed which may require a more sophisticated low pass filter, although one only. Still the real valued FFT will load the DSP by more than a factor of 2.
The following basic program will calculate the complex valued fourier transform. It is illustrative but inefficient.
rem Step frequency from -F to +F in N steps
This basic program gives exactly the same result as this FORTRAN program for FFT which if far more efficient.