Hello All, If we want to average many FFTs, to reduce noise variance, is it better for us to average FFT magnitudes or average the squares of the magnitudes? We see the averaging of magnitudes-squared in DSP articles, but is that the best thing to do? Thank you, JDH
Spectrum analysis question
Started by ●September 24, 2008
Reply by ●September 24, 20082008-09-24
On 24 Sep, 17:49, JDHar...@DeleteHotmail.com (James Harris) wrote:> Hello All, > � �If we want to average many FFTs, to reduce noise variance, is it > better for us to average FFT magnitudes or average the squares of the > magnitudes? �We see the averaging of magnitudes-squared in > DSP articles, but is that the best thing to do?Throwing away the phase info means implicitly that you are only intersted in the Power Spectrum Density, PSD, not the spectrum as such. The total PSD should then be the average of many PSDs, meaning that you should avreage the squared magnitudes. To see why, check out the difference between s1 = 1/2 ( |a|^2 + |b|^2 ) and s2 = 1/2 ( |a| + |b| )^2 = 1/2 ( |a|^2 + 2 |a| |b| + |b|^2 ) If you compute the sum-of-squared-magnitudes (s1) there are no cross terms and the result is easy to analyze. If you compute the square-of-summed-magnitudes (s2) you get all sorts of cross terms which influence the end result in bad ways. Rune
Reply by ●September 24, 20082008-09-24
On Sep 25, 3:49 am, JDHar...@DeleteHotmail.com (James Harris) wrote:> Hello All, > If we want to average many FFTs, to reduce noise variance, is it > better for us to average FFT magnitudes or average the squares of the > magnitudes? We see the averaging of magnitudes-squared in > DSP articles, but is that the best thing to do? > > Thank you, > JDHOne is averaging power spectrum and the other amplitude spectrum.
Reply by ●September 25, 20082008-09-25
On Wed, 24 Sep 2008 11:21:53 -0700 (PDT), Rune Allnor <allnor@tele.ntnu.no> wrote:>On 24 Sep, 17:49, JDHar...@DeleteHotmail.com (James Harris) wrote: >> Hello All, >> =A0 =A0If we want to average many FFTs, to reduce noise variance, is it >> better for us to average FFT magnitudes or average the squares of the >> magnitudes? =A0We see the averaging of magnitudes-squared in >> DSP articles, but is that the best thing to do? > >Throwing away the phase info means implicitly that you are only >intersted in the Power Spectrum Density, PSD, not the spectrum >as such. > >The total PSD should then be the average of many PSDs, meaning >that you should avreage the squared magnitudes. > >To see why, check out the difference between > >s1 =3D 1/2 ( |a|^2 + |b|^2 ) > >and > >s2 =3D 1/2 ( |a| + |b| )^2 =3D 1/2 ( |a|^2 + 2 |a| |b| + |b|^2 ) > >If you compute the sum-of-squared-magnitudes (s1) there are no >cross terms and the result is easy to analyze. If you compute >the square-of-summed-magnitudes (s2) you get all sorts of cross >terms which influence the end result in bad ways. > >RuneHello, thnak you for your answer. I think I didn't explain our problem well enough so I will try again. Say we captured 10 non-overlapping blocks of 64 time samples of the same signal, then we performed 10 FFTs. The 64-point FFTs are: X1(f),,X2(f), X3(f), ...., X10(f). If we want to compute a low-variance measurement of the spectral content of the 17-th bin, should we average | X1(17)| + | X2(17)| + | X3(17)|,..., + | X10(17)|, or should we average | X1(17)|^2 + | X2(17)|^2 + | X3(17)|^2,..., + | X10(17)|^2? My modeling shows that either way (averaging magnitudes, or averaging magnitudes-squared), the variance of of the averaged values is reduced. Searching the web, it looks like people usually average magnitudes-squared, but we do not know why. It seems like averaging magnitudes is just as good as averaging magnitudes-squared. May be that I have made an error in my modeling. Any help will be appreciated. Thank you, JDH
Reply by ●September 25, 20082008-09-25
On 25 Sep, 13:23, JDHar...@DeleteHotmail.com (James Harris) wrote:> My modeling shows that either way (averaging magnitudes, > or averaging magnitudes-squared), the variance of of > the averaged values is reduced. > > Searching the web, it looks like people usually average > magnitudes-squared, but we do not know why. �It seems > like averaging magnitudes is just as good as averaging > magnitudes-squared.It is correct that either way will cause deviations to reduce. Th ereaso why people use the average of squared magnitudes is that these data relate directly to the power sepctral density, whereas the squared average of magnitudes contains the cross terms which makes the result useless for power and SNR analyses. Rune
Reply by ●September 25, 20082008-09-25
On Sep 24, 8:49�am, JDHar...@DeleteHotmail.com (James Harris) wrote:> Hello All, > � �If we want to average many FFTs, to reduce noise variance, is it > better for us to average FFT magnitudes or average the squares of the > magnitudes? �We see the averaging of magnitudes-squared in > DSP articles, but is that the best thing to do?If you average complex magnitudes, you can make a signal disappear by offsetting the FFT frames so that the signal starts at the opposite phase on alternate frame. Or, for any fixed FFT frame offset, there exist signal frequencies that will cancel themselves out due to phase rotation of the complex FFT result across the sum. Are you OK with disappearing magnitudes at these frequencies? If not, then use magnitude squared, where the phase information is thrown away so that the magnitudes can't cancel themselves out across frames due to phase rotation. . IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M http://www.nicholson.com/rhn/dsp.html
Reply by ●September 25, 20082008-09-25
On Sep 25, 7:23 am, JDHar...@DeleteHotmail.com (James Harris) wrote:> On Wed, 24 Sep 2008 11:21:53 -0700 (PDT), Rune Allnor > > > > <all...@tele.ntnu.no> wrote: > >On 24 Sep, 17:49, JDHar...@DeleteHotmail.com (James Harris) wrote: > >> Hello All, > >> =A0 =A0If we want to average many FFTs, to reduce noise variance, is it > >> better for us to average FFT magnitudes or average the squares of the > >> magnitudes? =A0We see the averaging of magnitudes-squared in > >> DSP articles, but is that the best thing to do? > > >Throwing away the phase info means implicitly that you are only > >intersted in the Power Spectrum Density, PSD, not the spectrum > >as such. > > >The total PSD should then be the average of many PSDs, meaning > >that you should avreage the squared magnitudes. > > >To see why, check out the difference between > > >s1 =3D 1/2 ( |a|^2 + |b|^2 ) > > >and > > >s2 =3D 1/2 ( |a| + |b| )^2 =3D 1/2 ( |a|^2 + 2 |a| |b| + |b|^2 ) > > >If you compute the sum-of-squared-magnitudes (s1) there are no > >cross terms and the result is easy to analyze. If you compute > >the square-of-summed-magnitudes (s2) you get all sorts of cross > >terms which influence the end result in bad ways. > > >Rune > > Hello, thnak you for your answer. > > I think I didn't explain our problem well enough so I > will try again. > Say we captured 10 non-overlapping blocks of 64 time > samples of the same signal, then we performed 10 FFTs. > The 64-point FFTs are: > > X1(f),,X2(f), X3(f), ...., X10(f). > > If we want to compute a low-variance measurement of the > spectral content of the 17-th bin, should we average > > | X1(17)| + | X2(17)| + | X3(17)|,..., + | X10(17)|, > > or should we average > > | X1(17)|^2 + | X2(17)|^2 + | X3(17)|^2,..., + | X10(17)|^2? > > My modeling shows that either way (averaging magnitudes, > or averaging magnitudes-squared), the variance of of > the averaged values is reduced. > > Searching the web, it looks like people usually average > magnitudes-squared, but we do not know why. It seems > like averaging magnitudes is just as good as averaging > magnitudes-squared. May be that I have made an error > in my modeling. Any help will be appreciated. > > Thank you, > JDHThis topic is covered in Whalen's "Detection of signals in noise" book. One of the methods has slight increase in Prob of detection at low SNR's - I believe the average over magnitude method but I'm not sure. Whalen refers to one as the linear detector and the other as a quadratic. For the most the ROC curves for the 2 methods are pretty similar. In practise you tend to see the average of mag. squared since only 1 sqrt is needed - and is thus less computationally intensive. For the quadratic method you end up with central and non-central Chi squared statistics, while for the linear method you have Rayleigh and Rician models. Again I'm going by memory, so I may have that backwards. Cheers, Dave
Reply by ●September 26, 20082008-09-26
On Sep 24, 11:49�am, JDHar...@DeleteHotmail.com (James Harris) wrote:> Hello All, > � �If we want to average many FFTs, to reduce noise variance, is it > better for us to average FFT magnitudes or average the squares of the > magnitudes? �We see the averaging of magnitudes-squared in > DSP articles, but is that the best thing to do? > > Thank you, > JDHI'd say for most applications, you probably want to average the magnitude squared. But, the ultimate answer depends on: what are you trying to do exactly? Jason
Reply by ●September 26, 20082008-09-26
Ron N wrote:> On Sep 24, 8:49�am, JDHar...@DeleteHotmail.com (James Harris) wrote: > > > Hello All, > > � �If we want to average many FFTs, to reduce noise variance, is it > > better for us to average FFT magnitudes or average the squares of the > > magnitudes? �We see the averaging of magnitudes-squared in > > DSP articles, but is that the best thing to do? > > If you average complex magnitudes, ...Uh, Ron, complex magnitudes?
Reply by ●September 26, 20082008-09-26
On Sep 25, 7:23 am, JDHar...@DeleteHotmail.com (James Harris) wrote:> Searching the web, it looks like people usually average > magnitudes-squared, but we do not know why. It seems > like averaging magnitudes is just as good as averaging > magnitudes-squared. May be that I have made an error > in my modeling. Any help will be appreciated.Several reasons why averaging the squares may give a better result were presented. But ignoring that and supposing for a moment that the result were somehow the same, averaging the squares still appeals to the lazy - why bother taking all those square roots before averaging, when you can just do it once after averaging? (Or not at all, if what you want is the log magnitude the square root becomes division by two after the log operation. And if what you want is the log _power_, you don't even divide by two)






