Gentle comp.dsp'ers, I again have a question that is essentially the same as the one I posted back at the beginning of April, but better stated. Assume one has a buffer of 65536 samples, and the goal is to measure the energy between Fs/4 and Fs/2 (just arbitrary frequencies selected for this example) - half the available digital bandwidth - with as little energy from the 0 to Fs/4 band in the measurement as possible. Method one: use a DFT. The manner in which the DFT is applied is open for discussion. Method two: construct a large FIR, say, 500 taps or more, with a near-brick-wall frequency response and measure the energy of the output of this filter with the input data applied. Which do you think is more accurate in rejecting energy from 0 to Fs/4? --Randy
Energy Measurement
Started by ●June 6, 2006
Reply by ●June 6, 20062006-06-06
On 6 Jun 2006 17:27:22 -0700, "Randy Yates" <yates@ieee.org> wrote:>Gentle comp.dsp'ers, > >I again have a question that is essentially the same as the one I >posted back at the beginning of April, but better stated. > >Assume one has a buffer of 65536 samples, and the goal is to measure >the energy between Fs/4 and Fs/2 (just arbitrary frequencies selected >for this example) - half the available digital bandwidth - with as >little energy from the 0 to Fs/4 band in the measurement as possible. > >Method one: use a DFT. The manner in which the DFT is applied is open >for discussion. > >Method two: construct a large FIR, say, 500 taps or more, with a >near-brick-wall frequency response and measure the energy of the >output of this filter with the input data applied. > >Which do you think is more accurate in rejecting energy from 0 to >Fs/4? > >--RandyHi Randy, what an interesting question. So many things to consider. Assuming that your time samples are not windowed before they are applied to an N-point DFT, leakage from your "unwanted" N/2 DFT bins will show up, to some degree, in your N/2 "bins of interest". My vote is that you use your Method Two (high-performance FIR filter). 500 taps ought to give you one butt-kickin' filter! Good Luck, [-Rick-]
Reply by ●June 7, 20062006-06-07
Rick Lyons wrote:> On 6 Jun 2006 17:27:22 -0700, "Randy Yates" <yates@ieee.org> wrote: > > >Gentle comp.dsp'ers, > > > >I again have a question that is essentially the same as the one I > >posted back at the beginning of April, but better stated. > > > >Assume one has a buffer of 65536 samples, and the goal is to measure > >the energy between Fs/4 and Fs/2 (just arbitrary frequencies selected > >for this example) - half the available digital bandwidth - with as > >little energy from the 0 to Fs/4 band in the measurement as possible. > > > >Method one: use a DFT. The manner in which the DFT is applied is open > >for discussion. > > > >Method two: construct a large FIR, say, 500 taps or more, with a > >near-brick-wall frequency response and measure the energy of the > >output of this filter with the input data applied. > > > >Which do you think is more accurate in rejecting energy from 0 to > >Fs/4? > > > >--Randy > > Hi Randy, > what an interesting question. So many things to > consider. > > Assuming that your time samples are not windowed > before they are applied to an N-point DFT, > leakage from your "unwanted" N/2 DFT bins will show > up, to some degree, in your N/2 "bins of interest". > > My vote is that you use your Method Two (high-performance > FIR filter). 500 taps ought to give you one > butt-kickin' filter!Hey Rick, That's what my intuition tells me, too, but how do you justify that to the manager who's heard the terms "FFT" and "DSP" used almost interchangeably all their life that an FFT is not the way to go? Indeed, how do you justify it to yourself? --Randy
Reply by ●June 7, 20062006-06-07
Randy Yates wrote:> Rick Lyons wrote: > >>On 6 Jun 2006 17:27:22 -0700, "Randy Yates" <yates@ieee.org> wrote: >> >> >>>Gentle comp.dsp'ers, >>> >>>I again have a question that is essentially the same as the one I >>>posted back at the beginning of April, but better stated. >>> >>>Assume one has a buffer of 65536 samples, and the goal is to measure >>>the energy between Fs/4 and Fs/2 (just arbitrary frequencies selected >>>for this example) - half the available digital bandwidth - with as >>>little energy from the 0 to Fs/4 band in the measurement as possible. >>> >>>Method one: use a DFT. The manner in which the DFT is applied is open >>>for discussion. >>> >>>Method two: construct a large FIR, say, 500 taps or more, with a >>>near-brick-wall frequency response and measure the energy of the >>>output of this filter with the input data applied. >>> >>>Which do you think is more accurate in rejecting energy from 0 to >>>Fs/4? >>> >>>--Randy >> >>Hi Randy, >> what an interesting question. So many things to >>consider. >> >>Assuming that your time samples are not windowed >>before they are applied to an N-point DFT, >>leakage from your "unwanted" N/2 DFT bins will show >>up, to some degree, in your N/2 "bins of interest". >> >>My vote is that you use your Method Two (high-performance >>FIR filter). 500 taps ought to give you one >>butt-kickin' filter! > > > Hey Rick, > > That's what my intuition tells me, too, but how do you > justify that to the manager who's heard the terms "FFT" > and "DSP" used almost interchangeably all their life that > an FFT is not the way to go? Indeed, how do you justify > it to yourself?Construction of some representative waveforms which you then test by both methods. Then it isn't intuition any more, but calculation. Rick's "assuming no windowing": why? Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●June 7, 20062006-06-07
Randy Yates wrote:> Gentle comp.dsp'ers, > > I again have a question that is essentially the same as the one I > posted back at the beginning of April, but better stated. > > Assume one has a buffer of 65536 samples, and the goal is to measure > the energy between Fs/4 and Fs/2 (just arbitrary frequencies selected > for this example) - half the available digital bandwidth - with as > little energy from the 0 to Fs/4 band in the measurement as possible. > > Method one: use a DFT. The manner in which the DFT is applied is open > for discussion. > > Method two: construct a large FIR, say, 500 taps or more, with a > near-brick-wall frequency response and measure the energy of the > output of this filter with the input data applied. > > Which do you think is more accurate in rejecting energy from 0 to > Fs/4? > > --Randy >Without trying it, I'd guess method two will do better than all the windowing crud in method one. However, I'm more interested in a related power measurement issue. I take a low frequency (low relative to the sampling rate) square wave. Because it is low frequency, it retains most of its squareness in the sampled world. If I do the usual dot product job to assess its power, the result is the same as for a true square wave, which is a good approximation to what I have. Now I change the frequency to exactly Fs/4 (going to the end of the band - Fs/2 - is philosophically troublesome, so lets stay a bit lower). The dot product calculation gives me the result for a true square wave of frequency Fs/4. However, in the sampled world I really have just a sine wave. The power calculation is 3dB out. Pain, isn't it? Regards, Steve
Reply by ●June 7, 20062006-06-07
Steve Underwood wrote:> Randy Yates wrote: > >> Gentle comp.dsp'ers, >> >> I again have a question that is essentially the same as the one I >> posted back at the beginning of April, but better stated. >> >> Assume one has a buffer of 65536 samples, and the goal is to measure >> the energy between Fs/4 and Fs/2 (just arbitrary frequencies selected >> for this example) - half the available digital bandwidth - with as >> little energy from the 0 to Fs/4 band in the measurement as possible. >> >> Method one: use a DFT. The manner in which the DFT is applied is open >> for discussion. >> >> Method two: construct a large FIR, say, 500 taps or more, with a >> near-brick-wall frequency response and measure the energy of the >> output of this filter with the input data applied. >> >> Which do you think is more accurate in rejecting energy from 0 to >> Fs/4? >> >> --Randy >> > > Without trying it, I'd guess method two will do better than all the > windowing crud in method one. However, I'm more interested in a related > power measurement issue. > > I take a low frequency (low relative to the sampling rate) square wave. > Because it is low frequency, it retains most of its squareness in the > sampled world. If I do the usual dot product job to assess its power, > the result is the same as for a true square wave, which is a good > approximation to what I have. Now I change the frequency to exactly Fs/4 > (going to the end of the band - Fs/2 - is philosophically troublesome, > so lets stay a bit lower). The dot product calculation gives me the > result for a true square wave of frequency Fs/4. However, in the sampled > world I really have just a sine wave. The power calculation is 3dB out. > Pain, isn't it?Steve, The pure sine that you have is 4/pi times the amplitude of the square wave. If the power of the square wave is 1, then the power in the fundamental is 4/(pi * sqrt(2) = .900, only .91 dB down from the entire square wave. The discrepancy isn't as bad as you made it seem. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●June 7, 20062006-06-07
What (DFT) method does one deem best, so that the test result is conclusive? --Randy Jerry Avins wrote:> Randy Yates wrote: > > Rick Lyons wrote: > > > >>On 6 Jun 2006 17:27:22 -0700, "Randy Yates" <yates@ieee.org> wrote: > >> > >> > >>>Gentle comp.dsp'ers, > >>> > >>>I again have a question that is essentially the same as the one I > >>>posted back at the beginning of April, but better stated. > >>> > >>>Assume one has a buffer of 65536 samples, and the goal is to measure > >>>the energy between Fs/4 and Fs/2 (just arbitrary frequencies selected > >>>for this example) - half the available digital bandwidth - with as > >>>little energy from the 0 to Fs/4 band in the measurement as possible. > >>> > >>>Method one: use a DFT. The manner in which the DFT is applied is open > >>>for discussion. > >>> > >>>Method two: construct a large FIR, say, 500 taps or more, with a > >>>near-brick-wall frequency response and measure the energy of the > >>>output of this filter with the input data applied. > >>> > >>>Which do you think is more accurate in rejecting energy from 0 to > >>>Fs/4? > >>> > >>>--Randy > >> > >>Hi Randy, > >> what an interesting question. So many things to > >>consider. > >> > >>Assuming that your time samples are not windowed > >>before they are applied to an N-point DFT, > >>leakage from your "unwanted" N/2 DFT bins will show > >>up, to some degree, in your N/2 "bins of interest". > >> > >>My vote is that you use your Method Two (high-performance > >>FIR filter). 500 taps ought to give you one > >>butt-kickin' filter! > > > > > > Hey Rick, > > > > That's what my intuition tells me, too, but how do you > > justify that to the manager who's heard the terms "FFT" > > and "DSP" used almost interchangeably all their life that > > an FFT is not the way to go? Indeed, how do you justify > > it to yourself? > > Construction of some representative waveforms which you then test by > both methods. Then it isn't intuition any more, but calculation. > > Rick's "assuming no windowing": why? > > Jerry > -- > Engineering is the art of making what you want from things you can get. > =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF==AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF= =AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF=AF
Reply by ●June 7, 20062006-06-07
Randy Yates skrev:> Gentle comp.dsp'ers, > > I again have a question that is essentially the same as the one I > posted back at the beginning of April, but better stated. > > Assume one has a buffer of 65536 samples, and the goal is to measure > the energy between Fs/4 and Fs/2 (just arbitrary frequencies selected > for this example) - half the available digital bandwidth - with as > little energy from the 0 to Fs/4 band in the measurement as possible. > > Method one: use a DFT. The manner in which the DFT is applied is open > for discussion. > > Method two: construct a large FIR, say, 500 taps or more, with a > near-brick-wall frequency response and measure the energy of the > output of this filter with the input data applied. > > Which do you think is more accurate in rejecting energy from 0 to > Fs/4?If you want to estimate the energy of one frame of data, of length 65536, go with the DFT. The reason is Parseval's identity. If you need to monitor some continuous signal on-line, use the filter. Rune
Reply by ●June 7, 20062006-06-07
Randy Yates wrote:> What (DFT) method does one deem best, so that the test result > is conclusive? > > --RandyA DFT is a DFT. I would imagine that the window is the main determinant of merit. At this stage of the inquiry, I think "highly indicative" rather than "conclusive" is a reasonable goal. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by ●June 7, 20062006-06-07
Jerry Avins wrote:> Randy Yates wrote: > > What (DFT) method does one deem best, so that the test result > > is conclusive? > > > > --Randy > > A DFT is a DFT.Really? So none of the possible implementations make any difference? : 1. Take 32768 two-point DFTs and average the result. 2. Take 16374 four-point DFTs and average the result. . . . 14. Take 2 32768-point DFTs and average the result 15. Take 1 65536-point DFT 16. Zero-extend the 65536 points to 131032 points and take a 131032-point DFT. . . . Combine these choices with multiple choices in windowing and combining of the resulting bins and I think you have pretty much an infinite number of ways to perform the operation, and I'm pretty sure they're not all going to give the same result. ---Randy






