 DSP Tricks: Spectral peak location algorithm - Embedded.com

# DSP Tricks: Spectral peak location algorithm

In the practical world of discrete spectrum analysis, we often want toestimate the frequency of a sinusoid (or the center frequency of a verynarrowband signal of interest).

Upon applying the radix-2 fast Fourier transform (FFT), ournarrowband signals of interest rarely reside exactly on an FFT bincenter whose frequency is exactly known. As such, due to the FFT'sleakage properties, the discrete spectrum of a sinusoid having Ntime-domain samples may look like the magnitude samples shown in Figure 13-37(a), below.  Figure13-37. Spectral magnitudes: (a) N-point FFT; (b) 4N-point FFT.

There we see the sinusoid's spectral peak residing between the FFT'sm = 5 and m = 6 bin centers. (Variable m is an N-point FFT'sfrequency-domain index.

The FFT bin spacing is fs /N where, as always, fs is thesample rate.) Close examination of Figure 13-37(a) allows us to say thesinusoid lies in the range of m = 5 and m = 5.5, because we see thatthe maximum spectral sample is closer to the m = 5 bin center than them = 6 bin center.

The real-valued sinusoidal time signal has, in this example, afrequency of 5.25fs /N Hz. In this situation, our frequencyestimation resolution is half the FFT bin spacing.

We often need better frequency estimation resolution, and there areindeed several ways to improve that resolution.

We could collect, say, 4N time-domain signal samples and perform a4N-point FFT yielding a reduced bin spacing of fs /4N. Or wecould pad (append to the end of the original time samples) the originalN time samples with 3N zero-valued samples and perform a 4N-point FFTon the lengthened time sequence.

That would also provide an improved frequency resolution of fs /4N,as shown in Figure 13-37(b). With the spectral peak located at binmpeak = 21, we estimate the signal's center frequency, in Hz, using Both schemes, collect more data and zero-padding, arecomputationally expensive. Many other techniques for enhanced-precisionfrequency measurement have been described in the scientific literature- from the close-to-home field of geophysics to the lofty studies ofastrophysics – but most of those schemes seek precision without regardto computational simplicity.

Here we describe a computationally simple frequency estimationscheme. Assume we have FFT spectral samples X(m), of a real-valuednarrowband time signal, whose magnitudes are shown in Figure 13-38 below.  Figure13-38. FFT spectral magnitudes of a narrowband signal.

The vertical magnitude axis is linear, not logarithmic. The signal'sindex-based center frequency, mpeak, can be estimated using where real (δ) means the real part of the (δ) correction factordefined as where mk is the integer index of the largest magnitude sample |X(mk )|.Values X(mk”1 ) and X(mk+1 ) are the complexspectral samples on either side of the peak sample as shown in Figure13″38. Based on the complex spectral values, we compute the signal'sindex-based frequency mpeak (which may not be an integer), and applythat value to to provide a frequency estimate in Hz. Equations (13″73) and (13″74)apply only when the majority of the signal's spectral energy lieswithin a single FFT bin width (fs /N).

This spectral peak location estimation algorithm is quite accuratefor its simplicity. Its peak frequency estimation error is roughly0.06, 0.04, and 0.03 bin widths for signal-to-noise ratios of 3, 6, and9 dB respectively. Not bad at all!

The nice features of the algorithm are that it does not require theoriginal time samples to be windowed, as do some other spectral peaklocation algorithms, and it uses the raw FFT samples without the needfor spectral magnitudes to be computed.

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.

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