DSP Tricks: Building a practical spectrum analyzer

Here's a clever trick for implementing a practical spectrum analyzer finction bymodifying the time-domain data before applying a radix-2 FFT algorithm.Let's say we need to build a spectrum analyzer to display, in somemanner, the spectral magnitude of a time-domain sequence .

We'd like our spectrum analyzer, a bank of bandpass filters, to have afrequency magnitude response something like that shown in Figure 13-55(a) below.

Figure13-55 Spectrum analyzer: (a) desired frequency response; (b) frequencyresponse of standard FFT bins; (c) windowed-data FFT frequency response.

For spectrum analysis, the radix-2 FFT algorithm comes to mindfirst, as it should. However, the frequency response of individual FFTbins is that shown in Figure 13-55(b), with their non-flat passbands,unpleasantly high side lobes due to spectral leakage, and overlappedmain lobes.

We can reduce the leakage sidelobe levels by windowing thetime-domain sequence, but that leads to the increased main lobe overlapshown in Figure 13″55(c) and degraded frequency resolution, and westill have considerable droop in the passband response. Here's how wecan solve our problem. Consider an x(n) sequence of time samples oflength M whose M-point DFT is

Next consider partitioning x(n) into P subsequences, each of lengthN. Thus PN = M. If we add, element for element, the P subsequenceswe'll obtain a new y(n) sequence of length N whose N-point DFT is

The good news is that

That is, the DFT magnitudes of sequence y(n) are equal to a subsetof the longer DFT magnitudes of x(n). Y(m) is equal to a decimated-by-Pversion of X(k).

The relationship between |Y(m)| and |X(Pm)| doesn't seem tooimportant, but here's how we'll take advantage of that equality. We'llcreate an Mpoint window sequence whose single-bin frequency response,of an M-point FFT, is the bold curve in Figure 13-56(a) below .

Figure13-56. FFT spectrum analyzer frequency responses.

Instead of computing all M FFT outputs, we'll only compute everyPth output of the M-point FFT, implementing Eq. (13-105), giving us thedecimated FFT bins shown in Figure 13-56(b). In that figure P = 5.

That decimation of the frequency-domain |X(k)| spectrum isaccomplished in the time domain by a time-aliasing operation as shownin Figure 13-57 below whereagain, for example, P = 5. We partition the M-sample windowedx( n) timesequence into P = 5 subsequences, sum the subsequences element forelement to obtain the time-aliased N-sample y(n) sequence.

Figure13-57 FFT spectrum analyzer process.

Next the |Y(m)| spectral magnitudes are computed using the radix-2FFT. (With the input x(n) sequencebeing real-valued, with spectral symmetry, only N/2+1 the |Y(m)|magnitude values need be computed for display .)

This process, sweet in its simplicity, is called the weightedoverlap-add structure, and is alternatively referred to asthe window-presum FFT.

The most difficult part of building this analyzer is designing theM-point window sequence used to window the original x(n) sequence. Wedo that by specifying the window's frequency domain characteristicsjust as if it were a digital filter frequency response, and use ourfavorite filter design software to compute the filter's time-domainimpulse response.

That impulse response is the window sequence. With the signal samplerate being fs, the window's passband width will be just less than fs/N.This makes the filter's one-sided passband width roughly fs/2N.

Figure13-58 FFT analyzer example: (a) window sequence; (b) analyzer responsefor 64-point FFT bins |Y(3)|, |Y(4)|, and |Y(5)|.

Figure 13-58 above illustrates an example FFT analyzer with fs = 1 Mhz, N = 64, with P = 5making M = 320. The FFT bin spacing is 15.63 kHz, so the window designwas set for a passband width of 10 kHz (thus the filter's one-sided bandwidth wasspecified as 5 kHz in a Parks-McClellandesign routine ).

Figure 13-58(a) is the 320-point window sequence, while Figure13-58(b) shows FFT analyzer's response for the m = 3, 4, and 5 bins,with the [Y(4)] �'response being the solid curve.

The width of the spectrum analyzer's passbands is primarilycontrolled by the window's passband width. The center frequencies ofthe analyzer's individual passbands is defined by fs/N.

What this means is that the amount of overlap in the analyzer'spassbands depends on both the window's passband width, fs, and N. Thedynamic range of the analyzer can be increased by increasing P, whichincreases M and lengthens the x(n) sequence.

As M is increased, the longer window sequence will yield analyzerpassbands having a more rectangular shape, lower sidelobes, and reducedpassband ripple.

Again, to implement this radix-2 FFT spectrum analyzer, the lengthof the time-domain sequence (M) must be an integer multiple (P) of aninteger power of two (N).

Usedwith the permission of the publisher, Prentice Hall, this on-goingseries of articles on Embedded.com is based on copyrighted materialfrom “UnderstandingDigital Signal Processing, Second Edition” by Richard G. Lyons. Thebook can be purchased on line.

Richard Lyons is a consultingsystems engineer and lecturer with Besser Associates. As alecturer with Besser and an instructor for the University of CaliforniaSanta Cruz Extension, Lyons has delivered digitasl signal processingseminars and training course at technical conferences as well atcompanies such as Motorola, Freescale, Lockheed Martin, TexasInstruments, Conexant, Northrop Grumman, Lucent, Nokia, Qualcomm,Honeywell, National Semiconductor, General Dynamics and Infinion.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.