Sign in

username or email:

password:



Not a member?
Forgot your password?

Search blogs



Search tips

Articles by category

Our Bloggers

See Also

Embedded SystemsFPGA

DSP Blogs > Rick Lyons > Accurate Measurement of a Sinusoid's Peak Amplitude Based on FFT Data

Rick Lyons
Richard (Rick) Lyons is a consulting Systems Engineer and lecturer with Besser Associates in Mountain View, California. He is the author of "Understanding Digital Signal Processing 2/E" (Prentice-Hall, 2004), and Editor of, and contributor to, "Streamlining Digital Signal Processing, A Tricks of the Trade Guidebook" (IEEE Press/Wiley, 2007). He is also an Associate Editor for the IEEE Signal Processing Magazine.

RSS Feed

Would you like to be notified by email when Rick Lyons publishes a new blog?

  

Pageviews: 1367

Accurate Measurement of a Sinusoid's Peak Amplitude Based on FFT Data

Posted by Rick Lyons on Dec 14 2011 under Tips and Tricks   

There are two code snippets associated with this blog post:

Flat-Top Windowing Function for the Accurate Measurement of a Sinusoid's Peak Amplitude Based on FFT Data

and

Testing the Flat-Top Windowing Function

This blog discusses an accurate method of estimating time-domain sinewave peak amplitudes based on fast Fourier transform (FFT) data. Such an operation sounds simple, but the scalloping loss characteristic of FFTs complicates the process. We eliminate that complication by implementing 'flat-top' windowing by way of frequency-domain convolution in a way that greatly reduces scalloping-loss amplitude-estimation problems.

FFT SCALLOPING LOSS REVISITED
There are many applications that require the estimation of a time-domain sinewave's peak amplitude based on FFT data. Such applications include oscillator and analog-to-digital converter performance measurements, as well as standard total harmonic distortion (THD) testing. However, the scalloping loss inherent in FFTs creates an uncertainty in such time-domain peak amplitude estimations. This section provides a brief review of FFT scalloping loss.

As you know, if we perform an N-point FFT on N real-valued time-domain samples of a discrete sinewave, whose frequency is an integer multiple of fs/N (fs is the sample rate in Hz), the peak magnitude of the sinewave's positive-frequency spectral component will be

where A is the peak amplitude of the time-domain sinewave. That phrase "whose frequency is an integer multiple of fs/N" means that the sinewave's frequency is located exactly at one of the FFT's bin centers.

Now, if an FFT's input sinewave's frequency is between two FFT bin centers (equal to a non-integer multiple of fs/N) the FFT magnitude of that spectral component will be less that the value of M in Eq. (1). Figure 1 illustrates this behavior. Figure 1(a) shows the frequency responses of individual FFT bins where, for simplicity, we show only the mainlobes (no sidelobes) of the FFT bins' responses. What this means is that if we were to apply a sinewave to an FFT, and scan the frequency of that sinewave over multiple bins, the magnitude of the FFT's largest normalized magnitude sample value will follow the curve in Figure 1(b). That curve describes what is called the "scalloping loss" of an FFT [1].
(As an aside, the word scallop is not related to my favorite shellfish. As it turns out, some window drapery, and table cloths, do not have linear borders. Rather they have a series of circular segments, or loops, of fabric defining their decorative borders. Those loops of fabric are called scallops.)

What Figure 1(b) tells us is that if we examine the N-point FFT magnitude sample of an arbitrary-frequency, peak amplitude = A sinewave, that spectral component's measured peak magnitude Mpeak can be in anywhere in the range of:

depending on the frequency of that sinewave. This is shown as the rectangular window curve in Figure 2, where the maximum scalloping error occurs at a frequency midpoint between two FFT bins.

The variable M in Figure (2) is the M from (1). So if we want to estimate a sinewave's time-domain peak amplitude A, by measuring its maximum FFT spectral peak magnitude Mpeak, our estimated value of A, from Eq. (1), using

can have an error as great as 36.3%. In many spectrum analysis applications such a large potential error, equivalent to 3.9 dB, is unacceptable. Hanning and Hamming windowing of the FFT input data reduce the unpleasant frequency-dependent fluctuations in a measured spectral Mpeak value, as shown in Figure 2, but not nearly enough to satisfy many applications.

One solution to this frequency-dependent, FFT-based, measured amplitude uncertainty is to multiply the original N time-domain samples by an N-sample flat-top window function and then perform a new FFT on the windowed data. Flat-top window functions are designed to overcome the scallop loss inherent in rectangular-windowed FFTs. While such a flat-top-windowed FFT technique will work, there are more computationally-efficient methods to solve our signal peak amplitude estimation uncertainty problem.

An Accurate Measurement Process
We will solve our sinusoidal-peak measurement problem by performing convolution in the frequency domain as opposed to window-function multiplication in the time domain [2,3]. Consider the FFT magnitude samples shown in Figure 3, and let's assume we want to estimate the peak amplitude of the time-domain sinusoid corresponding to the large |X(k)| FFT sample.

We can compute the complex Xft(k) sample using

Once we have the value of the complex Xft(k) sample from Eq. (4), we use

in Eq. (3) to yield an accurate estimate of the sinewave's time-domain peak amplitude A. Our maximum error in an estimated value of peak amplitude A, using the |Xft(k)| from Eq. (4), is roughly 0.02 dB, and is depicted as the essentially-horizontal Flat-top curve in Figure 2. That's significantly smaller than the rectangular-windowed maximum error of 3.9 dB.

Three Important Issues
First, the flat-top window frequency-domain convolutions are most useful in accurately measuring the time-domain amplitude of a sinusoidal signal when that signal's spectral component is not contaminated by sidelobe leakage from a nearby spectral component. For example, if a positive-frequency spectral component is low in frequency, i.e., located in the first few FFT bins, leakage from a spectral component's corresponding negative-frequency spectral component will contaminate that positive-frequency spectral component. As such, this code should not be used for frequencies below the sixth FFT bin or above the (N/2–5)th FFT bin.

Second, the flat-top window frequency-domain convolutions are most useful when the FFT spectral component being measured is well above the background spectral noise floor.

Third, reference [3] gives more details regarding this flat-top windowing process plus some clever methods of efficiently implementing the process in programmable hardware.

In the Matlab code associated with this FFT-based sinewave peak amplitude estimation method, we perform time-domain flat-top windowing of FFT samples by way of frequency-domain convolution. The input to the code is a sequence of complex-valued FFT samples, and the output of the code is a sequence of complex-valued flat-top-windowed FFT samples. If the FFT's input was a sinusoidal signal, the amplitude of that sinusoid can be accurately estimated by using Eq. (3) where Mpeak is the maximum magnitude sample of the code's output sequence.

References
[1] F. Harris, "On the use of windows for harmonic analysis with the discrete Fourier transform," Proceedings of the IEEE, Vol. 66, No. 1, pp. 51-83, January 1978.

[2] E. Jacobsen, and R. Lyons, "The Sliding DFT", IEEE Signal Processing Magazine, DSP Tips & Tricks column, March, 2003.

[3] R. Lyons, "Reducing FFT Scalloping Loss Errors Without Multiplication", IEEE Signal Processing Magazine, DSP Tips & Tricks column, March, 2011, pp. 112-116.



Rate this article:
5
Rating: 5 | Votes: 3
 
   
 
posted by Rick Lyons
Richard (Rick) Lyons is a consulting Systems Engineer and lecturer with Besser Associates in Mountain View, California. He is the author of "Understanding Digital Signal Processing 2/E" (Prentice-Hall, 2004), and Editor of, and contributor to, "Streamlining Digital Signal Processing, A Tricks of the Trade Guidebook" (IEEE Press/Wiley, 2007). He is also an Associate Editor for the IEEE Signal Processing Magazine.

Previous post by Rick Lyons: Generating Complex Baseband and Analytic Bandpass Signals
Next post by Rick Lyons: The History of CIC Filters: The Untold Story
all articles by Rick Lyons

Would you like to be notified by email when Rick Lyons publishes a new blog?

  


Comments


Shep
Said:
Rick, your articles are great. Thank you! BTW: In Chapter 8 of "Handbook of DSP Engineering Applications" Academic Press 1987; F. Harris treats Scallop loss as well. (Pp648, 684)
1 year ago
0
Reply
Sorry, you need javascript enabled to post any comments.
Rick Lyons
Replied:
Hello Shep, If you'd like a copy of a more detailed article on this topic, send me an E-mail. [R.Lyons@ieee.org]
1 year ago
0
Mariam
Said:
And what about noise? I mean will your method work when signal is corrupted? You wrote "the flat-top window frequency-domain convolutions are most useful when the FFT spectral component being measured is well above the background spectral noise floor." It's not enough. RMS error as function of SNR would be interesting. And one more question: can one measure peak аmplitude(-s) of any kind of modulated signals by means of your method?
1 year ago
0
Reply
Sorry, you need javascript enabled to post any comments.
Rick Lyons
Replied:
Hello Mariam, My my. You ask good questions. No, I have not modeled that 'peak-amplitude estimation' scheme in the presence of noise. Maybe you could investigate that scenario and post a blog here with your results. As for that scheme's performance for modulated signals, again, sorry but I have not studied that situation. My modeling was strictly for input sinusoids whose time-domain peak amplitudes remained constant. [-Rick-]
1 year ago
0
Mariam
Replied:
To post a blog here - о no, thank you, Rick. I'm interested in modulation recognition problem and am looking for algorithms useful in conditions of high level of uncertainty. It's difficult to find any (or I'm searching badly). Usually developers suppose there is much more information than it is in reality. Unfortunately it is impossible to understand if your method is useful. To find carrier parameters is neсessary but it isn't the main problem so far for me. Perhaps I'l have to think later about it.
1 year ago
0
mikewill
Said:
Hello Rick, This is a great article... I've never considered the duality of convolution in the frequency domain with multiplication in the time domain to solve this problem. I'm excited to try this technique out. In the past, I've used techniques to estimate frequency (given enough SNR) and apply a correction based on the windowing function's scalloping profile. Your technique seems much simpler. For the case of multiple (additive) sources, you seem to suggest about a 12 bin separation in order to get accuracy approaching the 0.2dB above. That's not too bad of a resolution requirement for many applications. Thanks again for the post. -Mike Williamson http://www.mitydsp.com
1 year ago
0
Reply
Sorry, you need javascript enabled to post any comments.
Sorry, you need javascript enabled to post any comments.