Reply by Rick Lyons June 1, 20152015-06-01
On Sun, 31 May 2015 06:21:16 -0500, "kaz" <37480@DSPRelated> wrote:

>>Hi Kaz, >> Years ago I used to refer to the value >>Fs/N as the DFT's "resolution". But over the >>years I realized that the word resolution means >>different things to different people. So now >>I merely refer to the value Fs/N as the DFT's >>"bin spacing". >> >>The word resolution is sometimes used in the wrong >>way. For example, I have read the words: >> >> "Increasing the value of N in an N-point DFT >> provides greater frequency resolution." >> >>By "greater" they meant Fs/N is smaller! Ha ha. >> >>What they should have written is: >> >> "Increasing the value of N in an N-point DFT >> provides improved frequency resolution." >> >>Better yet, they should have written: >> >> "Increasing the value of N in an N-point DFT >> provides smaller DFT bin spacing." >> >>[-Rick-] > >Hi Rick, > >Thanks for the post but I don't seem to grasp the difference between bin >resolution and frequency resolution(when detected by FFT). > >It reminds me of Welsh sheep joke: > >A physicist, a mathematician, a DSP engineer, a statistician and a >software engineer were on a mental rehab vacation to Wales(UK). They >spotted a black sheep, then > >The DSP engineer looked out of the window and said "Look! Welsh sheep are >black!" >The physicist said, "No, no. Some Welsh sheep are black." >The mathematician looked irritated. "There is at least one field, >containing at least one sheep, of which at least one side is black." > >The statistician said : "It's not significant. We only know there's one >black sheep" >The software guy said: "Oh, no! A special case!" > >Kaz
Hi Kaz, If you have Matlab software, I can send you some Matlab code that demonstrates the difference between DFT bin resolution (DFT bin spacing) and "frequency resolution" (the ability to recognize, or discern, that a spectral envelope contains two separate signals). If you're interested, send me a private e-mail. [-Rick-]
Reply by Cedron June 1, 20152015-06-01
>I was replying to Cedron, > >>In the noise-added case, the argument to acos() is in general complex.
>>What does your method do in this case? Is there a natural or >>best way of coming up with the desired real frequency? > >I now see that you wrote the following: > > acos( real( [WB]Z / WZ ) ) * [N/(2Pi)] > >which I interpret to mean you're discarding the imaginary part >of the argument to acos(). > >Steve
A most excellent question. There are two obvious candidates: The real part or The magnitude. I chose the former because of the lower computation cost. Also thinking that if the imaginary part represents noise, discarding it will act like a filter. This may not be true, I haven't studied it thoroughly and it remains an open question. Perhaps a better answer can be found in an analysis like this: cos( alpha) = WB(Z+E)/W(Z+E) cos( alpha) = WBZ/(WZ+WE) + WBE/(WZ+WE) 1/(WZ+WE) = 1/[WZ(1+WE/WZ)] ~=~ (1-WE/WZ)/WZ cos( alpha ) = WBZ/WZ + (terms with E in them) If we go back to the source and realize that we are talking about solutions to the linear differential equation r" + p r' + q r = 0, we can get a different insight. The general solution is r = C1 exp( a + bi ) + C2 exp( a - bi ) The pure tone case is when p = 0 and q > 0 leading to a = 0 and b representing the frequency of an oscillation. Within the context of the frequency equation, an imaginary component represents a non-zero a in the differential equation solution. Therefore it represents either exponential growth or decay. Looking at this closer is on my to-do list. Ced --------------------------------------- Posted through http://www.DSPRelated.com
Reply by glen herrmannsfeldt June 1, 20152015-06-01
Eric Jacobsen <eric.jacobsen@ieee.org> wrote:

(snip, someone wrote)
>>Thanks for the post but I don't seem to grasp the difference between bin >>resolution and frequency resolution(when detected by FFT).
> If one uses the definition of "resolution" as the ability to discern > two tones, then often the metric is the 3dB width of the main lobe of > the FT of the transform window. When a rectangular window is used > and there is no zero-padding, then this is equivalent to the DFT bin > width.
> If a non-rectangular window is used and/or there is zero-padding, then > the 3dB width of the main lobe tends to increase beyond a bin width > (sometimes very fractionally for some window functions). So for > those cases the usual two-tone resolution definition and the bin width > start to diverge.
> This is why it is often pointed out that zero-padding does not > increase the "resolution" of the DFT output.
Another way to see it, is that you don't get something for nothing. With the same input data, and linear operators, you can't get more out. The linear part is to allow for non-linear deconvolution, which can sometimes do surprising things with input data. -- glen
Reply by Steve Pope June 1, 20152015-06-01
I was replying to Cedron,

>In the noise-added case, the argument to acos() is in general complex. >What does your method do in this case? Is there a natural or >best way of coming up with the desired real frequency?
I now see that you wrote the following: acos( real( [WB]Z / WZ ) ) * [N/(2Pi)] which I interpret to mean you're discarding the imaginary part of the argument to acos(). Steve
Reply by Steve Pope June 1, 20152015-06-01
Cedron <103185@DSPRelated> wrote:

>My bin value formula article is blog 771, so I will refer to the equations >in it as (771-#). My frequency formula is blog 773, so likewise I will >refer to formulas in there as (773-#).
>I have seen the bin value formula taken up to step (771-17) in several >publications. It is so straightforward from the definitions that I have >no doubt that it was done long long ago. I have never seen within one of >these publications the "gooblygook" step of (771-20) taken. Every case >I've seen, including your similar blog article, discards one of the terms >in (771-17) as being insignificant. At this point exact becomes >approximate. Because I haven't found it, does by no means imply that it >hasn't been done.
>Once the gooblygook has been reduced by going back to the cosine >definitions, you get (771-22). I would be very appreciative of knowing if >this formula exists anywhere. [...] > >(771-23 to 25) is what I carry over to the Frequency Formula artice (773). > They are just a restatement of (771-22). Because of the simplified form, >a three bin set is fairly easily solved as a non-linear three >equations/three unknowns system. The solution (773-17 & 20) are what I am >calling the frequency formula. I put (773-17) in matrix form two >different ways, but they are equivalent. (773-18) is the one I've been >quoting as "cos( alpha ) = WBZ / WZ" in the posts.
Thanks for this clarification.
>To the best of my searching ability, and my futile attempts to ask the >experts, these equations haven't been solved by anybody else. I still >find this confounding. The derivation is not that tricky, however, it >does require having the simple enough bin value formulas to start with. I >still find it hard to believe that they weren't discovered long ago.
I haven't seen it either, but I haven't particularly looked for it.
>I would hope that the numerical results in the "Show me the numbers" >thread and Julien's preliminary results would be sufficient motivation for >more people to scrutinize these formulas and therefore improve the odds of >revealing a previous discovery.
I do have one question. You are stating 773-18 and its equivalents are the forumula, but it seems there is one missing detail in your algorithm (perhaps you have addressed this elsewhere, but it is not mentioned in 773). In the zero noise case, when you go through the first example at the end of 773 that leads to the exact frequency value of 10.4, you obtain this by taking acos(foo) where foo is real. It's real of course because there is no noise. In the noise-added case, the argument to acos() is in general complex. What does your method do in this case? Is there a natural or best way of coming up with the desired real frequency? Steve
Reply by Cedron May 31, 20152015-05-31
>>>> Thank you Ced and Kaz, >>>> >>>> Also thanks for the link about "Exact Frequency Formula for a >>>> Pure Real Tone in a DFT". >>> >>>i presume this is a sinusoidal tone. if it is, then i think it's a >>>solved problem if you know what the window is used before the DFT. >>> >>Well, I think you think wrong on this one. If it has been solved, it >>should be mentioned on these pages, don't you think? >> >>http://www.dspguru.com/dsp/howtos/how-to-interpolate-fft-peak >> >>http://www.ericjacobsen.org/fe2/fe2.htm >> > >Ced, > Robert B-J is correct. The equation for the DFT >samples, when the DFT's input is as real-valued >cosine wave, has been solved for decades. > >[-Rick-]
Hi Rick, Thanks. The formula you are talking about is what I call the "Bin Value Formula". The formula in the excerpt you quoted is the "Frequency Formula". My bin value formula article is blog 771, so I will refer to the equations in it as (771-#). My frequency formula is blog 773, so likewise I will refer to formulas in there as (773-#). I have seen the bin value formula taken up to step (771-17) in several publications. It is so straightforward from the definitions that I have no doubt that it was done long long ago. I have never seen within one of these publications the "gooblygook" step of (771-20) taken. Every case I've seen, including your similar blog article, discards one of the terms in (771-17) as being insignificant. At this point exact becomes approximate. Because I haven't found it, does by no means imply that it hasn't been done. Once the gooblygook has been reduced by going back to the cosine definitions, you get (771-22). I would be very appreciative of knowing if this formula exists anywhere. Since the difference of two cosines can be expressed as the product of two sines, this formula can be manipulated into many forms. I will be doing so in a future blog to provide a form that is more accurate when dealing with frequencies very close to integer values. (771-23 to 25) is what I carry over to the Frequency Formula artice (773). They are just a restatement of (771-22). Because of the simplified form, a three bin set is fairly easily solved as a non-linear three equations/three unknowns system. The solution (773-17 & 20) are what I am calling the frequency formula. I put (773-17) in matrix form two different ways, but they are equivalent. (773-18) is the one I've been quoting as "cos( alpha ) = WBZ / WZ" in the posts. To the best of my searching ability, and my futile attempts to ask the experts, these equations haven't been solved by anybody else. I still find this confounding. The derivation is not that tricky, however, it does require having the simple enough bin value formulas to start with. I still find it hard to believe that they weren't discovered long ago. Notice that I said discovered and not invented. Any superlatives I have used to describe the formulas should not be interpreted as casting any credit on me. I would hope that the numerical results in the "Show me the numbers" thread and Julien's preliminary results would be sufficient motivation for more people to scrutinize these formulas and therefore improve the odds of revealing a previous discovery. Ced --------------------------------------- Posted through http://www.DSPRelated.com
Reply by Rick Lyons May 31, 20152015-05-31
On Sun, 24 May 2015 07:16:46 -0500, "Cedron" <103185@DSPRelated>
wrote:

>[...snip...] >>On 5/23/15 6:11 PM, JCO_DSP wrote: >>> >>> Thanks for the comments Cedron. I have read your article. >> >>i didn't see a link to an article. >> >Technically, I didn't give a link, I gave a reference to "read my blog >articles at dsprelated (dot) com." > >Asking the Google with the title would have gotten you a link, but for >your convenience it is: > >http://www.dsprelated.com/showarticle/773.php > >>> >>> Thank you Ced and Kaz, >>> >>> Also thanks for the link about "Exact Frequency Formula for a >>> Pure Real Tone in a DFT". >> >>i presume this is a sinusoidal tone. if it is, then i think it's a >>solved problem if you know what the window is used before the DFT. >> >Well, I think you think wrong on this one. If it has been solved, it >should be mentioned on these pages, don't you think? > >http://www.dspguru.com/dsp/howtos/how-to-interpolate-fft-peak > >http://www.ericjacobsen.org/fe2/fe2.htm >
Ced, Robert B-J is correct. The equation for the DFT samples, when the DFT's input is as real-valued cosine wave, has been solved for decades. [-Rick-]
Reply by Eric Jacobsen May 31, 20152015-05-31
On Sun, 31 May 2015 06:21:16 -0500, "kaz" <37480@DSPRelated> wrote:

>>Hi Kaz, >> Years ago I used to refer to the value >>Fs/N as the DFT's "resolution". But over the >>years I realized that the word resolution means >>different things to different people. So now >>I merely refer to the value Fs/N as the DFT's >>"bin spacing". >> >>The word resolution is sometimes used in the wrong >>way. For example, I have read the words: >> >> "Increasing the value of N in an N-point DFT >> provides greater frequency resolution." >> >>By "greater" they meant Fs/N is smaller! Ha ha. >> >>What they should have written is: >> >> "Increasing the value of N in an N-point DFT >> provides improved frequency resolution." >> >>Better yet, they should have written: >> >> "Increasing the value of N in an N-point DFT >> provides smaller DFT bin spacing." >> >>[-Rick-] > >Hi Rick, > >Thanks for the post but I don't seem to grasp the difference between bin >resolution and frequency resolution(when detected by FFT).
If one uses the definition of "resolution" as the ability to discern two tones, then often the metric is the 3dB width of the main lobe of the FT of the transform window. When a rectangular window is used and there is no zero-padding, then this is equivalent to the DFT bin width. If a non-rectangular window is used and/or there is zero-padding, then the 3dB width of the main lobe tends to increase beyond a bin width (sometimes very fractionally for some window functions). So for those cases the usual two-tone resolution definition and the bin width start to diverge. This is why it is often pointed out that zero-padding does not increase the "resolution" of the DFT output.
>It reminds me of Welsh sheep joke: > >A physicist, a mathematician, a DSP engineer, a statistician and a >software engineer were on a mental rehab vacation to Wales(UK). They >spotted a black sheep, then > >The DSP engineer looked out of the window and said "Look! Welsh sheep are >black!" >The physicist said, "No, no. Some Welsh sheep are black." >The mathematician looked irritated. "There is at least one field, >containing at least one sheep, of which at least one side is black." > >The statistician said : "It's not significant. We only know there's one >black sheep" >The software guy said: "Oh, no! A special case!" > >Kaz >--------------------------------------- >Posted through http://www.DSPRelated.com
Eric Jacobsen Anchor Hill Communications http://www.anchorhill.com
Reply by kaz May 31, 20152015-05-31
>Hi Kaz, > Years ago I used to refer to the value >Fs/N as the DFT's "resolution". But over the >years I realized that the word resolution means >different things to different people. So now >I merely refer to the value Fs/N as the DFT's >"bin spacing". > >The word resolution is sometimes used in the wrong >way. For example, I have read the words: > > "Increasing the value of N in an N-point DFT > provides greater frequency resolution." > >By "greater" they meant Fs/N is smaller! Ha ha. > >What they should have written is: > > "Increasing the value of N in an N-point DFT > provides improved frequency resolution." > >Better yet, they should have written: > > "Increasing the value of N in an N-point DFT > provides smaller DFT bin spacing." > >[-Rick-]
Hi Rick, Thanks for the post but I don't seem to grasp the difference between bin resolution and frequency resolution(when detected by FFT). It reminds me of Welsh sheep joke: A physicist, a mathematician, a DSP engineer, a statistician and a software engineer were on a mental rehab vacation to Wales(UK). They spotted a black sheep, then The DSP engineer looked out of the window and said "Look! Welsh sheep are black!" The physicist said, "No, no. Some Welsh sheep are black." The mathematician looked irritated. "There is at least one field, containing at least one sheep, of which at least one side is black." The statistician said : "It's not significant. We only know there's one black sheep" The software guy said: "Oh, no! A special case!" Kaz --------------------------------------- Posted through http://www.DSPRelated.com
Reply by Tim Wescott May 30, 20152015-05-30
On Sat, 23 May 2015 12:10:22 -0500, JCO_DSP wrote:

> Hi, > > I'm starting to learn DSP (Matlab )and I have two questions about it, > maybe someone can help me out? > > I'm trying to measure a frequency from an Audio Device and I'm using FFT > to transform it from the time domain to the frequency domain. But I am > doing a downsample before the FFT. But you can also do it after the FFT. > Do you know what would be the most efficient (before or after)? And why? > > Another question, I am using zero padding to increase my system > resolution (up to 50Hz). My frame length is N=256 and sample frequency > fs= 44100 Hz. So 44100/50 = 882, so I need to add 626 zeroes (to 256 > frame length) to get 50 Hz resolution, I hope this is correct? I believe > this is done for FFT. But is this the same for the DFT?
If you're still with us -- did you get your question answered? -- www.wescottdesign.com