Reply by commsignal October 11, 20122012-10-11
I have a question regarding this discussion. I have a signal for which I
have to take the DFT, but it is being multiplied by e^(j omega n), i.e.,
has a frequency offset. If I take the DFT and the period of omega doesn't
coincide with transform size, I have DFT leakage. I know omega but due to
some reason, I can't pre-correct it. What can we do in such a situation
(except windowing)?
Thank you.
Reply by dbd October 9, 20122012-10-09
On Friday, October 5, 2012 5:33:08 PM UTC-7, Tim Wescott wrote:

> > Well, you seem to be missing what I was talking about. If you apply a > > _window_ to data with a DC bias, then your result after DFT is going to > > be the DFT of the window, plus the DFT of the "interesting stuff". It's > > not going to be a spike at DC -- it's going to bleed out into adjoining > > frequency bins. If there's something interesting (and small) in those > > bins, then it'll be lost in the noise generated by the DFT of the window. > > > > You can easily end up with a frequency plot that's nothing more than the > > DFT of whatever window you chose, if you fail to remove the DC bias first. > > ... > Tim Wescott, Communications, Control, Circuits & Software
The most commonly used window, the rectangular, does not bleed signal into adjacent bins. This is the window I intended in my last post (and should have stated explicitly). For any window length that is a positive integer multiple of the transform size, the rectangular window will have zeros for its response at the other frequency bins. Then the dft of the DC term is only in the DC bin and is all that is in the DC bin. Other length rectangular windows will not have this effect, for example, zero filling a data set with zeros to match a larger transform size. Even with the rectangular window of the right size there are significant implementation details. The DC term might exceed the dynamic range of the dft implementation or force the other signal stuff down towards the quantization limits of the dft implementation. A frequent real world problem is that the big term is not exactly at DC, for example, a 60 Hz interference on high frequency samples with a window of much less than 16msec duration. These problems are not windows issues. If you want to use a non-rectangular window in the very large true DC case, with the cosine-sum window family (including von Hann, Hamming, the Blackmans, etc.) you can use the dft DC coefficient to approximately estimate the correction to the adjacent dft coefficiets. Aside from quantization limitations of the impementation, windows do not produce "noise generated by the fft of the window". The effects are determinate, the dft of the window as has been suggested, which effects are zero for the rectangular window of appropriate lengths. The rectangular window can be viewed as the cosine-sum window where only 1 coefficient needs correction. Dale B. Dalrymple
Reply by Eric Jacobsen October 6, 20122012-10-06
On Fri, 05 Oct 2012 19:33:07 -0500, Tim Wescott <tim@seemywebsite.com>
wrote:

>On Fri, 05 Oct 2012 14:37:25 -0700, dbd wrote: > >> On Thursday, October 4, 2012 1:13:28 PM UTC-7, Tim Wescott wrote: ... >> >>> So, having established your expertise by insult, please back up that >>> statement! >> >> And what backup did you give your statement? >> >> >>> Show how taking the DFT of a sample with a small signal embedded in a >>> honkin' big DC offset, windowed, _doesn't_ have a huge contribution >>> from the window! >>> >>> >> Your simple statement didn't include this qualification or the small DFT >> size case glen discusses. (Or the limited resolution situation case >> which becomes important if you include the big signal qualification.) >> >> The DFT is a linear operator. The mean of the time domain data is the DC >> term in the frequency domain. Subtraction of this component from both >> domains does not alter any term in the frequency domain but the DC term. >> >>> ... particularly in that it is something that's being pointed out to an >>> obviously rank beginner who clearly hasn't had much mileage at all with >>> using the DFT for signal analysis. >> >> You post a lot here and often usefully. If a stupid poster had posted >> something stupid I might not comment. You know how to post coherently. >> You didn't here. Exactly because of the OP's inexperience, I felt it >> worth a quick kick. >> >>> Tim Wescott >> >> Dale B. Dalrymple > >Well, you seem to be missing what I was talking about. If you apply a >_window_ to data with a DC bias, then your result after DFT is going to >be the DFT of the window, plus the DFT of the "interesting stuff".
I'm struggling to understand the issue. The DC bin is the same as any other bin a DFT. The output will be the DFT of the unwindowed input convolved with the DFT of the window. Bin zero is part of this just like any other bin, and not any more or less than any other bin.
> It's >not going to be a spike at DC -- it's going to bleed out into adjoining >frequency bins.
Just like every other bin will, consistent with the DFT of the window function.
> If there's something interesting (and small) in those >bins, then it'll be lost in the noise generated by the DFT of the window.
Just like any bin can swamp any other bin if the relative magnitudes and sidelobes work out that way.
>You can easily end up with a frequency plot that's nothing more than the >DFT of whatever window you chose, if you fail to remove the DC bias first.
And any tone present can swamp adjacent tones if it's big enough and they're small enough. That's normal.
>Been there (when I had hair), done that, still remember... > >-- >My liberal friends think I'm a conservative kook. >My conservative friends think I'm a liberal kook. >Why am I not happy that they have found common ground? > >Tim Wescott, Communications, Control, Circuits & Software >http://www.wescottdesign.com
Eric Jacobsen Anchor Hill Communications www.anchorhill.com
Reply by glen herrmannsfeldt October 5, 20122012-10-05
Tim Wescott <tim@seemywebsite.com> wrote:
> On Fri, 05 Oct 2012 14:37:25 -0700, dbd wrote: >> On Thursday, October 4, 2012 1:13:28 PM UTC-7, Tim Wescott wrote: ...
>>> So, having established your expertise by insult, please back up that >>> statement!
(snip)
>> Your simple statement didn't include this qualification or the small DFT >> size case glen discusses. (Or the limited resolution situation case >> which becomes important if you include the big signal qualification.)
(bigger snip)
> Well, you seem to be missing what I was talking about. If you apply a > _window_ to data with a DC bias, then your result after DFT is going to > be the DFT of the window, plus the DFT of the "interesting stuff". It's > not going to be a spike at DC -- it's going to bleed out into adjoining > frequency bins. If there's something interesting (and small) in those > bins, then it'll be lost in the noise generated by the DFT of the window.
Yes. But some windows will have only small components other than at zero, and some signals will have enough non-zero frequency components that you don't notice.
> You can easily end up with a frequency plot that's nothing more than the > DFT of whatever window you chose, if you fail to remove the DC bias first.
That can also happen. Some time ago, I was thinking about how to explain Nyquist sampling in the case of a finite length band limited signal. If both end points are zero, then it is easy to argue that it is made up of sines of the appropriate frequencies up to the band limit. If the end points aren't zero, then subtract a straight line through the two end points, and you need two more values to reproduce the original. The sines should need 2N-1 where N is the length divided by the sampling period, truncated, so slightly more than Nyquist would lead you to believe. The Nyquist rate works for either infinite length or periodic signals. -- glen
Reply by Tim Wescott October 5, 20122012-10-05
On Fri, 05 Oct 2012 14:37:25 -0700, dbd wrote:

> On Thursday, October 4, 2012 1:13:28 PM UTC-7, Tim Wescott wrote: ... > >> So, having established your expertise by insult, please back up that >> statement! > > And what backup did you give your statement? > > >> Show how taking the DFT of a sample with a small signal embedded in a >> honkin' big DC offset, windowed, _doesn't_ have a huge contribution >> from the window! >> >> > Your simple statement didn't include this qualification or the small DFT > size case glen discusses. (Or the limited resolution situation case > which becomes important if you include the big signal qualification.) > > The DFT is a linear operator. The mean of the time domain data is the DC > term in the frequency domain. Subtraction of this component from both > domains does not alter any term in the frequency domain but the DC term. > >> ... particularly in that it is something that's being pointed out to an >> obviously rank beginner who clearly hasn't had much mileage at all with >> using the DFT for signal analysis. > > You post a lot here and often usefully. If a stupid poster had posted > something stupid I might not comment. You know how to post coherently. > You didn't here. Exactly because of the OP's inexperience, I felt it > worth a quick kick. > >> Tim Wescott > > Dale B. Dalrymple
Well, you seem to be missing what I was talking about. If you apply a _window_ to data with a DC bias, then your result after DFT is going to be the DFT of the window, plus the DFT of the "interesting stuff". It's not going to be a spike at DC -- it's going to bleed out into adjoining frequency bins. If there's something interesting (and small) in those bins, then it'll be lost in the noise generated by the DFT of the window. You can easily end up with a frequency plot that's nothing more than the DFT of whatever window you chose, if you fail to remove the DC bias first. Been there (when I had hair), done that, still remember... -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Reply by dbd October 5, 20122012-10-05
On Thursday, October 4, 2012 1:13:28 PM UTC-7, Tim Wescott wrote:
...

> So, having established your expertise by insult, please back up that > statement!
And what backup did you give your statement?
> > Show how taking the DFT of a sample with a small signal embedded in a > honkin' big DC offset, windowed, _doesn't_ have a huge contribution from > the window! >
Your simple statement didn't include this qualification or the small DFT size case glen discusses. (Or the limited resolution situation case which becomes important if you include the big signal qualification.) The DFT is a linear operator. The mean of the time domain data is the DC term in the frequency domain. Subtraction of this component from both domains does not alter any term in the frequency domain but the DC term.
> ... particularly in that it is something that's > being pointed out to an obviously rank beginner who clearly hasn't had > much mileage at all with using the DFT for signal analysis.
You post a lot here and often usefully. If a stupid poster had posted something stupid I might not comment. You know how to post coherently. You didn't here. Exactly because of the OP's inexperience, I felt it worth a quick kick.
> Tim Wescott
Dale B. Dalrymple
Reply by glen herrmannsfeldt October 4, 20122012-10-04
dbd <dbd@ieee.org> wrote:
> On Tuesday, October 2, 2012 9:13:07 AM UTC-7, Tim Wescott wrote: > ...
>> If you're windowing you need to remove the mean, or you just end up with >> the DFT of the window.
> It's silly posts like this that make Vlad post the way he does.
I had to think about this one for at least a few seconds. For short sequences and windows, it is pretty true. For longer ones, less true. Well, a window might round of just the end points to a long sequence of data points, which won't have a big effect on other than the 0 componens, but a really big effect on a short sequence. -- glen
Reply by Tim Wescott October 4, 20122012-10-04
On Thu, 04 Oct 2012 12:25:10 -0700, dbd wrote:

> On Tuesday, October 2, 2012 9:13:07 AM UTC-7, Tim Wescott wrote: ... >> >> If you're windowing you need to remove the mean, or you just end up >> with the DFT of the window. > > It's silly posts like this that make Vlad post the way he does. > >> Tim Wescott >> Control system and signal processing consulting > except apparently, the DFT > > Dale B. Dalrymple
Excuse me! So, having established your expertise by insult, please back up that statement! Show how taking the DFT of a sample with a small signal embedded in a honkin' big DC offset, windowed, _doesn't_ have a huge contribution from the window! Assuming that you can't do that, then please explain exactly how my -- true -- statement is "silly", particularly in that it is something that's being pointed out to an obviously rank beginner who clearly hasn't had much mileage at all with using the DFT for signal analysis. Show your work. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Reply by dbd October 4, 20122012-10-04
On Tuesday, October 2, 2012 9:13:07 AM UTC-7, Tim Wescott wrote:
...
> > If you're windowing you need to remove the mean, or you just end up with > the DFT of the window.
It's silly posts like this that make Vlad post the way he does.
> Tim Wescott > Control system and signal processing consulting
except apparently, the DFT Dale B. Dalrymple
Reply by Benoit Leprettre October 4, 20122012-10-04
Le mardi 2 octobre 2012 01:59:55 UTC+2, MBALOVER a &#4294967295;crit&#4294967295;:
> Hi all, > > > > In code of an algorithm I see that the author often detrends signal before FFT. I search for it in the Internet and the objective of the function is "detrend removes the mean value or linear trend from a vector or matrix, usually for FFT processing". > > Can you explain what is the effect of detrend and what if the data is not detrended before FTT?
Hi, Removing artifacts caused by end-to-end discontinuities is one thing and detrending may, in some case, contribute to solving that. However, the real thing to attenuate these artifacts is rather windowing. Detrending serves a different purpose. Suppose your trend in a large constant (DC component = average). The result of your FFT will show a very large value at the zero frequency (DC). This value in likely to "mask" other interesting features of your spectrum, because it larger. It's annoying because you need to zoom in to see the other frequencies of interest. It's not that the interesting information is not there, it's just that it is hidden by your DC. If you want to remove it to concentrate on the "interesting" frequencies of your signal, you just detrend the input signal by removing its mean. Similarly, if you have a visible trend like a linear trend, that is, a slow variation of your signal, then your spectrum will be "polluted" by its low frequency components the same way as with a mere DC component. So, provided you know this trend is not significant for your purpose, you may want to remove it beforehand, to better highlight other, higher-frequency, more interesting features of your signal. B.L.