DSPRelated.com
Forums

Frequency Resolution

Started by Simeon October 2, 2011
Hi,
As far as I know the longer you sample or the faster you sample gives you 
higher frequency resolution. In other words:

                  f_res = f_s/N
where:
    f_res is the difference (in Hz) between two bins in the frequency 
domain
    f_s = sampling frequency
    N = number of samples (including zero padding if necessary)


As a reference this is also stated in "Understanding Digital Signal 
Processing" 3rd Edition, p. 138.

Then I saw this:

https://ccrma.stanford.edu/~jos/sasp/One_Sine_One_Cosine.html

Towards the bottom it says:

                 M >= 2(f_s/f_res)

where:
    M is the number of (non-zero) time domain samples i.e. window length
    f_s = sampling frequency
    f_res = resolution required

It's very late and I haven't slept much but should I understand that we 
need:

M >= 2*N_res

where the N_res above is the N required to give us bin width of f_res?

Example:

f_s = 100Hz;

I need f_res of 5Hz
.:. N = f_s/f_res = 20;

.:. M >= 40

or in other words we need to sample for at least:
t_sampling = 1/100 * 40 = 0.4s (@ f_s = 100Hz)

Simeon
On Oct 2, 4:15=A0pm, Simeon <kotap...@yahoo.com> wrote:
> Hi, > As far as I know the longer you sample or the faster you sample gives you > higher frequency resolution.
... There are many meanings for and definitions of "frequency resolution". The more useful specify conditions on the signal being measured and involve an actual measurement of frequency. There are some characteristics that some people expect in their definitions of frequency resolution like: resolution should be better at higher SNRs (which need to have definitions for too), resolution should get better with more samples, resolution should be better with samples over a longer time interval. Some people throw up a formula with no reason why. What are you calculating the frequency of? What is your definition of frequency resolution? What do you expect to be able to do with the number you calculate as frequency resolution? Dale B. Dalrymple
On Sun, 02 Oct 2011 16:34:21 -0700, dbd wrote:

> There are many meanings for and definitions of "frequency resolution". > The more useful specify conditions on the signal being measured and > involve an actual measurement of frequency. There are some > characteristics that some people expect in their definitions of > frequency resolution like: resolution should be better at higher SNRs > (which need to have definitions for too), resolution should get better > with more samples, resolution should be better with samples over a > longer time interval. Some people throw up a formula with no reason why.
By frequency resolution I mean: The minimum frequency difference between two signals (sinusoids) that will allow us to still differentiate the two signals and not just see a merged single signal.
On Oct 2, 5:29=A0pm, Simeon <kotap...@yahoo.com> wrote:
...
> > By frequency resolution I mean: > > The minimum frequency difference between two signals (sinusoids) that > will allow us to still differentiate the two signals and not just see a > merged single signal.
That's a curious answer that looks like a holdover from the swept- spectrum to analog oscilloscope days, and a common source of error. The analog-like description goes that there is a dip in amplitude between the two peaks that "resolves the peaks". Do you mean at particular signal strengths? At infinite SNR? as a function of SNR? at a particular phase offset? averaged over all phase offsets? In the digital world the term "see" is meaningless without definition. The "dip" requires definition. The DSP literature has many definitions to replace the analog approach. (Sometimes incorrect because of incomplete statement of the valid conditions. Do you mean an actual digital implementation? Is the solution restricted to a set of allowed algorithms? Do you mean in a theoretical sense? The power spectrum of the FFT of arbitrarily large size with arbitrarily large zero-fill? (This particular theoretical algorithm provides a way to "see" a "dip", but you still need a statement of signal conditions and you don't get a good way to actually perform the measurement.) Another approach is to turn it around and give a target application and implementation environment if you have them and ask what is a good definition for frequency resolution. Dale B. Dalrymple

Simeon wrote:

> Hi, > As far as I know the longer you sample or the faster you sample gives you > higher frequency resolution. In other words: > > f_res = f_s/N > where: > f_res is the difference (in Hz) between two bins in the frequency > domain > f_s = sampling frequency > N = number of samples (including zero padding if necessary) > > > As a reference this is also stated in "Understanding Digital Signal > Processing" 3rd Edition, p. 138. > > Then I saw this: > > https://ccrma.stanford.edu/~jos/sasp/One_Sine_One_Cosine.html > > Towards the bottom it says: > > M >= 2(f_s/f_res) > > where: > M is the number of (non-zero) time domain samples i.e. window length > f_s = sampling frequency > f_res = resolution required > > It's very late and I haven't slept much but should I understand that we > need: > > M >= 2*N_res > > where the N_res above is the N required to give us bin width of f_res? > > Example: > > f_s = 100Hz; > > I need f_res of 5Hz > ..:. N = f_s/f_res = 20; > > ..:. M >= 40 > > or in other words we need to sample for at least: > t_sampling = 1/100 * 40 = 0.4s (@ f_s = 100Hz) > > Simeon
On Sun, 02 Oct 2011 18:20:01 -0700, dbd wrote:

> On Oct 2, 5:29&nbsp;pm, Simeon <kotap...@yahoo.com> wrote: ... >> >> By frequency resolution I mean: >> >> The minimum frequency difference between two signals (sinusoids) that >> will allow us to still differentiate the two signals and not just see a >> merged single signal. > > That's a curious answer that looks like a holdover from the swept- > spectrum to analog oscilloscope days, and a common source of error. The > analog-like description goes that there is a dip in amplitude between > the two peaks that "resolves the peaks". > > Do you mean at particular signal strengths? At infinite SNR? as a > function of SNR? at a particular phase offset? averaged over all phase > offsets? > > In the digital world the term "see" is meaningless without definition. > The "dip" requires definition. The DSP literature has many definitions > to replace the analog approach. (Sometimes incorrect because of > incomplete statement of the valid conditions. > > Do you mean an actual digital implementation? Is the solution restricted > to a set of allowed algorithms? Do you mean in a theoretical sense? The > power spectrum of the FFT of arbitrarily large size with arbitrarily > large zero-fill? (This particular theoretical algorithm provides a way > to "see" a "dip", but you still need a statement of signal conditions > and you don't get a good way to actually perform the measurement.) > > Another approach is to turn it around and give a target application and > implementation environment if you have them and ask what is a good > definition for frequency resolution. > > Dale B. Dalrymple
I've written a small script to observe DFT/FFT resolution and I think it helped me. It's just that this article confused me and I still don't know what he's on about: https://ccrma.stanford.edu/~jos/sasp/One_Sine_One_Cosine.html with the line: M>= 2*N_res but anyway. Below is the script for people who might encounter this discussion :). %---Clear previous session--- %clear all current variables clear; %close all figures close all; %---Clear previous session--- %---Set variables--- %set a time variable t = 0:0.01:.9 ; N_time = size(t,2); %get a dt dt = max(t)./(size(t,2)-1); %get the sampling frequency fs = dt.^(-1); %N_freq = N_time; N_freq = 10000 %10*N_time; %get a df df = fs./N_freq; %set a frequency variable f = 0:df:(fs-df); f1 = 5.14; %Hz f2 = 5.15; %Hz %---Set variables--- %---Do some maths (actual signal)--- x = cos(2*pi*f2*t) + cos(2*pi*f1*t); %x = x - mean(x); X = abs(fft(x,N_freq)); %---Do some maths (actual signal)--- %---Plotting--- subplot(2,1,1); plot(t,x, '-*'); grid on; title('Time Domain Plot'); xlabel('time'); ylabel('signal, x'); subplot(2,1,2); plot(f, X, '-*'); grid on; title('Frequency Domain Plot'); xlabel('frequency'); ylabel('magnitude'); %---Plotting---
On Oct 2, 7:24=A0pm, Simeon <kotap...@yahoo.com> wrote:
...
> > I've written a small script to observe DFT/FFT resolution and I think it > helped me. It's just that this article confused me and I still don't know > what he's on about: > > https://ccrma.stanford.edu/~jos/sasp/One_Sine_One_Cosine.html >
What is demonstrated in the article is that number of samples in the measurement and what I called the phase offset interact to produce changes in the depth of the dip as well as the frequency estimates of the tones and their separations that might not have been expected. That's why I said it was important to make a definite statement of the definition of the test and the conditions allowed for the signals before you could expect a definite answer. Note that the answer may require you to accept an average value and variance over the selected range of signal conditions to get an accurate description. I don't see anything in your script or the figure generated that has any relationship to a meaning of resolution, but if you expect a DFT related definition, the more understanding of the fft you have the better. Dale B. Dalrymple
On Oct 2, 9:25=A0pm, dbd <d...@ieee.org> wrote:
> On Oct 2, 7:24=A0pm, Simeon <kotap...@yahoo.com> wrote: > ... > > > > > I've written a small script to observe DFT/FFT resolution and I think i=
t
> > helped me. It's just that this article confused me and I still don't kn=
ow
> > what he's on about: > > >https://ccrma.stanford.edu/~jos/sasp/One_Sine_One_Cosine.html > > What is demonstrated in the article is that number of samples in the > measurement and what I called the phase offset interact to produce > changes in the depth of the dip as well =A0as the frequency estimates of > the tones and their separations that might not have been expected. > That's why I said it was important to make a definite statement of the > definition of the test and the conditions allowed for the signals > before you could expect a definite answer. Note that the answer may > require you to accept an average value and variance over the selected > range of signal conditions to get an accurate description. > > I don't see anything in your script or the figure generated that has > any relationship to a meaning of resolution, but if you expect a DFT > related definition, the more understanding of the fft you have the > better. > > Dale B. Dalrymple
The author of the article is trying to convey something the guys in early DSO development use to to talk about all the time, =93number of data pts per display=94. It was an esthetic issue. To put it into words, add more time samples and gain spectral resolution.
On Oct 3, 6:24=A0am, me0...@yahoo.com wrote:

> ... > The author of the article is trying to convey something the guys in > early DSO development use to to talk about all the time, =93number of > data pts per display=94. =A0It was an esthetic issue.
> To put it into words, add more time samples and gain spectral > resolution.
The number of "data pts per display" is constant. The number of sample points in the rectangular window is what varies. The data points plotted all come from a transform of size 1024. To understand why the author considers the "One Sine and One Cosine" case, look at the difference between the plots in Figure 5.7 of the "Two Cosines" case and those in Figure 5.8. This author is calculating a 1024 point transform implementation of what I referred to as "The power spectrum of the FFT of arbitrarily large size with arbitrarily large zero-fill". I guess that that was enough points for the author's "esthetic". The author demonstrates both the "Two cosines" case and the "One Sine and One Cosine" case because relative phase does affect the ability to resolve two components. Dale B. Dalrymple
On Oct 3, 7:46=A0am, dbd <d...@ieee.org> wrote:
> On Oct 3, 6:24=A0am, me0...@yahoo.com wrote: > > > ... > > The author of the article is trying to convey something the guys in > > early DSO development use to to talk about all the time, =93number of > > data pts per display=94. =A0It was an esthetic issue. > > To put it into words, add more time samples and gain spectral > > resolution. > > The number of "data pts per display" is constant. The number of sample > points in the rectangular window is what varies. The data points > plotted all come from a transform of size 1024. To understand why the > author considers the "One Sine and One Cosine" case, look at the > difference between the plots in Figure 5.7 of the "Two Cosines" case > and those in Figure 5.8. > > This author is calculating a 1024 point transform implementation of > what I referred to as "The power spectrum of the FFT of arbitrarily > large > size with arbitrarily large zero-fill". I guess that that was enough > points for the author's "esthetic". > > The author demonstrates both the "Two cosines" case and the "One Sine > and One Cosine" case because relative phase does affect the ability to > resolve two components. > > Dale B. Dalrymple
Hmm, I didn=92t see the info re the size of the FFT, but what I thought he was doing was removing zero padding and replacing it with real data. In my simple mind he eventually ends up on bin =85 Call me an idiot .. I give.