Forums

Zero-Padding as scalloping loss attenuator

Started by jmarcelold 6 years ago13 replieslatest reply 6 years ago644 views

Hello,

I am working in a signal detector system, based on DFT, that has as input N=1280 samples from a signal where multiple tones may be present. In order to use a radix-2 FFT algorithm, I have applied zero-padding to adjust the sequence length to M=2048 points. By doing this, I know that I have reduced the scalloping loss, but I have not find an equation that quantifies the scalloping loss for a zero-padded signal.

Please, can someone provide me  a reference for an equation that gives the maximum scalloping loss as a function of the ratio N/M, or something like that?

Regards

[ - ]
Reply by JOSOctober 20, 2016

There should be no such thing as "scalloping loss" :-)

Seriously, when a sinusoid's frequency falls between FFT bins, you should combine adjacent bins to get a decent estimate of the sinusoid's amplitude, phase, and/or frequency.  The fundamental problem is interpolation of spectral samples.  I generally use quadratic interpolation of dB magnitude samples, in addition to a sufficient zero-padding factor. Search for the "QIFFT Method" - the accuracy formulas you seek have been tabulated.  For example, in audio, with a Blackman window, zero-padding by a factor of 2 is nearly always "audibly perfect".

[ - ]
Reply by Rick LyonsOctober 21, 2016

Hello jmarcelold,

My understanding of the DFT characteristic called “scalloping” is described in the following blog.

https://www.dsprelated.com/showarticle/538.php

And as far as I know the effect (the fundamental behavior) of scalloping is the same regardless of the size value of your M) of a DFT.

What Prof. Smith (JOS) is telling you is important. Based on DFT results there are ways to estimate (rather accurately) the magnitude, phase, and frequency of a sinusoid that lies between DFT bins centers.

I noticed that your M value is M = 5x256 = 1280. If you wish to do so, I believe you can perform a 1280-point DFT by way of performing five individual 256-point radix-2 FFTs and combining their results in a special way. That whole scheme is described at:

https://www.dsprelated.com/showarticle/63.php

jmarcelold, if your question was not answered to your satisfaction here, then just keep on asking for clarification. Good Luck.

[ - ]
Reply by jmarceloldOctober 21, 2016

Hi Lyons,

I am aware that i can use a mixed radix fft algorithm, but i'm going to implement this solution in an FPGA, and the FFT IP that I have is for power of 2 size only. I thought about combine zero-padding with other techniques, but since a precision of +- 1 dB for the amplitude estimation was acceptable for me, and the MatLab code below return -1.44, i have considered use the zero-padding alone.  

I will read the text recommended by you and JOS to improve my knowledge in this subject, my understanding of scalloping loss may be wrong.

Tank you all for the help.

N=1280;

M=2048;

x = exp(2j*pi*.5*(0:N-1)/M);

X=20*log10(abs(1/N*fft(x,M)));

X(1)

this return -1.44, which is much better than -3.92.

   

[ - ]
Reply by Rick LyonsOctober 22, 2016

Hi jmarcelold, 

I didn't say anything about mixed-radix FFTs. I said "five individual 256-point FFTs."  In any case, perhaps the material in the following blog will be of some value to you:

https://www.dsprelated.com/showarticle/155.php

[ - ]
Reply by jmarceloldOctober 23, 2016

I always think on data flow graph, because I am more used to RTL design than software design. That is why I called mixed-radix, I can not avoid to see the radix-5 butterfly in the graph of the operation that combines the results from the 5 FFTs. :)

Thank you for the last link.

I will improve my -1.44 dB using a window or the QIFFT Method, or both!!






[ - ]
Reply by drmikeOctober 20, 2016

I think Rick can answer this in his sleep.  Check out section 3.11 in "Understanding Digital Signal Processing".  

[ - ]
Reply by Rick LyonsOctober 21, 2016

Dear Mike,

Ha ha. You have more confidence in me than I do. Regretfully, my memory is just about as reliable as the paper towel dispenser in the Men's Room.

[ - ]
Reply by Tim WescottOctober 21, 2016

If Rick is like me, he'll have to check that section to see what he said.  I've found that one of the nice things about authoring a book is that when I forget what I'm doing I have a handy reference written by someone who thinks like me.

[ - ]
Reply by Tim WescottOctober 20, 2016

First, there are FFT algorithms that work with numbers of bins other than 2^n -- even prime numbers of bins are supposed to be pretty fast.  I can't remember then name of the oft-recommended code, but a search on "open-source FFT" should bring it to light.

Second, I don't know what this "scalloping" is that you speak of -- do you mean spectral leakage?

Third, if your signal is periodic on 1280 samples, then you really want to do the FFT on those 1280 samples.  If it isn't, then you need to window the signal to minimize spectral leakage.  Just zero-padding is going to wreak havoc on the readability of your spectrum.  Windowing will be in Rick's book, too.

[ - ]
Reply by JOSOctober 21, 2016

@Tim: Scalloping loss refers to the "droop" in magnitude that occurs between FFT bins when you don't combine them properly.  It depends on the window used.  For a length M rectangular window, whose DTFT is W(fT) = sin(M pi f T) / sin(pi f T), the scalloping attenuation for a length N DFT in bin k half way to the next bin is W(0.5/N) / W(0).  There is no scalloping loss at fT = k/N for integer k.

@jmarcelold: If you really have to put up with this attenuation, you can calculate it (and compensate it!) using the following calculation (matlab):

octave:1> M=1280; N=2048; fT=0.5/N; 20*log10((sin(M*pi*fT)/sin(pi*fT))/M)
ans = -1.4431

Sorry I had to interchange your definitions of N and M to better conform with decades of signal-processing literature :-)

[ - ]
Reply by jmarceloldOctober 21, 2016

Thank you Jos!

This is exactly what I was looking for.

Now the procedure to compute the scalloping loss for any combination of window and zero padding is clear to me :)

[ - ]
Reply by stephanebOctober 22, 2016

@jmarcelold,

please make sure to:

1- click on the 'thumbsup' button associated to the post(s) that you find the most helpful

2- click on the beer button to reward the users who helped you the most (no cost to you)

If you are not sure what I am talking about, more details can be found in this thread.

Thank you!


[ - ]
Reply by dudelsoundOctober 24, 2016

The equation you seek has been given before, but here's an additional thought on scalloping loss that I found scanning through the net:

http://dspguru.com/sites/dspguru/files/Scalloping%...

These people apply a flat-top window to avoid scalloping loss in an arbitrary sized FFT - so far so old...

To reduce overhead they replace the multiplication of the window function in the time domain by convolution in the frequency domain - and they only compute this convolution for the max-sized bin.

While not a direct answer to your question I found the approach noteworthy