DSPRelated.com
Forums

Maximum resolution in Fourier

Started by Marc Kroeks August 30, 2008
Question about maximum resolution in Fourier.

For a project i am asked to make an application measures the EEG with a 
samplewindow of about 2 seconds and take a spectrum analysis of that with a 
resolution of minimum .1 Hz. Apparently the resolution is usually given as 
1/SampleLength, so in this case .5 Hz. Now my sampling device can make 
recordings of with up to 2048 Hz sample rate, so I imagined that with a high 
enough sample rate, there should be a way to disciminate a 8.5Hz wave from a 
8.6Hz wave (we are looking at the peak energy in different ranges from 3 to 
7, 7 to 13 and 13 to 20 Hz. So I came up with an algorithm that lays a sine 
and a cosine wave over the sample with frequencies from 3 to 20 in steps of 
.1Hz and stores the summation in an array. That seems to give some increase 
in resolution, only for a single signal in the source, (eg. in source 8.3 hz 
gives a peak energy at 8,3 hz exactly); when i mix two waves, the maximum 
distance over which they show up separately is about .3 Hz, then the peaks 
fuse.

DLLIMPORT long __stdcall MyFFT (long lNin, double dInArray[], long lNout, 
double dOutArray[], double dFromHz, double dToHz, double dResolution, double 
dSampleRate)
{

    long i,j ;
    double d, f, s, z ;
    double re[lNout] ;
    double im[lNout] ;

    s = 0.0;

    for (i = 0; i<lNout; i++)
    {
        d = i * dResolution + dFromHz;
        re[i] = 0.0;
        im[i] = 0.0;
        f = (d * 2.0 * PI) / dSampleRate;
        for (j = 0; j<lNin; j++)
        {
            z = j * f;
            re[i] += dInArray[j] * cos(z);
            im[i] += dInArray[j] * sin(z);
        }
        dOutArray[i] =  sqrt(re[i] * re[i] + im[i] * im[i]);
    }

    return 0;
}

My question, is there a way to take a spectrum with a certain given 
resolution (res Hz) when the samplelength is fixed (sl seconds) and the 
samplerate (sr Hz) can be adjusted?
The idea is, that the things we are searching for last not so long, maybe a 
few seconds, so that taking a longer samplelength would average that thing 
out. Are "WaveLets" something that i should study for this purpose?

Looking forward to your reply,
Marc Kroeks. 


hi

> My question, is there a way to take a spectrum with a certain given > resolution (res Hz) when the samplelength is fixed (sl seconds) and the > samplerate (sr Hz) can be adjusted? > The idea is, that the things we are searching for last not so long, maybe a > few seconds, so that taking a longer samplelength would average that thing > out. Are "WaveLets" something that i should study for this purpose? > > Looking forward to your reply, > Marc Kroeks.
Maybe, haven't tried this myself. 1) Sample at a high frequency and bit depth 2) construct many close repeated mirrors of length = n*num_samples - n* close_constant i.e. remove one sample at a time and repeat wave for synchronous detection 3) Construct some kind of weighted sum of each of the ffts to produce a suitable power spectrum As I said it may work, but I have not tried it cheers jacko http://nibz.googlecode.com
On 30 Aug, 09:21, "Marc Kroeks" <i...@tanzkraft.de> wrote:
> Question about maximum resolution in Fourier. > > For a project i am asked to make an application measures the EEG with a > samplewindow of about 2 seconds and take a spectrum analysis of that with a > resolution of minimum .1 Hz.
Define "resolution." There are two different meanings: 1) Ho far two close sinusoidals can be before they merge into one 2) Compute a spectrum coefficient at a given frequency
> Apparently the resolution is usually given as > 1/SampleLength, so in this case .5 Hz.
This is known as either the Heissenberg limit or the time-bandwidth product which governs the solution to question 1) above. It is a fundamental property of the DFT that you can not beaten.
> Now my sampling device can make > recordings of with up to 2048 Hz sample rate, so I imagined that with a high > enough sample rate, there should be a way to disciminate a 8.5Hz wave from a > 8.6Hz wave (we are looking at the peak energy in different ranges from 3 to > 7, 7 to 13 and 13 to 20 Hz.
It is solely the duration of the recording that determines the bin widths. If you double the sampling rate and keep the duration fixed, the extra spectrum coefficients are spent filling in the band between the old and the new sampling frequency. The bin widths remain unaltered. ...
> My question, is there a way to take a spectrum with a certain given > resolution (res Hz) when the samplelength is fixed (sl seconds) and the > samplerate (sr Hz) can be adjusted? > The idea is, that the things we are searching for last not so long, maybe a > few seconds, so that taking a longer samplelength would average that thing > out. Are "WaveLets" something that i should study for this purpose?
The only way to separate two close sinusoidals is to record for at least as long as stated by the Heissenberg inequality. Wavelets is a different tool to do similar things as the DFT, but they, too, are governed by the Heissenberg inequality. Rune
Hi

I don't know if I have the same problem as you do from what I have
understood.

If you perform a fourier transform of a signal over a specific lenght of
time you will obtain the frquency spectrum of the signal. If for argument
sakes the signal containes just three very closely placed sine waves (1Hz
apart) these will appear as one whole peak in your spectrum from what I
have experimented and increasing the sampling frequency still does not
produce specific peaks beyond a certain point i.e when the sine waves are
very close. 

So my question is is there a theoretical maximum for frequency components
being recognazible when they are close together in the fourier transform
and if so how can closely frequency located signals be analyzed ?

Thanks 
Aaron 



On 30 Aug, 11:19, jacko <jackokr...@gmail.com> wrote:
> hi > > > My question, is there a way to take a spectrum with a certain given > > resolution (res Hz) when the samplelength is fixed (sl seconds) and the > > samplerate (sr Hz) can be adjusted? > > The idea is, that the things we are searching for last not so long, maybe a > > few seconds, so that taking a longer samplelength would average that thing > > out. Are "WaveLets" something that i should study for this purpose? > > > Looking forward to your reply, > > Marc Kroeks. > > Maybe, haven't tried this myself. > 1) Sample at a high frequency and bit depth > 2) construct many close repeated mirrors of length = n*num_samples - > n* close_constant > i.e. remove one sample at a time and repeat wave for synchronous > detection > 3) Construct some kind of weighted sum of each of the ffts to produce > a suitable power spectrum > > As I said it may work, but I have not tried it > > cheers > jacko > > http://nibz.googlecode.com
More to the point is delta_phase error over sampling interval can be modified by dropping samples, and the time average of many blocks will increase the Q of a frequency bin. I am not sure totally of the forrier workings, but I think that the displaced copy of the sample set would beome a heavside correlation sort of spectrum. I am sure with enough pure maths, you could work out very accurate methods to combine the spectra low ends. Calculation of the high frequency bins is pointless for your purposes. Using bicubic sample interpolation, all mirror nsample sets could be 'made' the same length, Gaussian density interpolation anyone? cheers jacko
Prior art politeness would imply a <yourname>-jaxon-gaussian-heavyside-
fourier naming to your methods. ;-)
On 30 Aug, 08:21, "Marc Kroeks" <i...@tanzkraft.de> wrote:
> Question about maximum resolution in Fourier. > > For a project i am asked to make an application measures the EEG with a > samplewindow of about 2 seconds and take a spectrum analysis of that with a > resolution of minimum .1 Hz. Apparently the resolution is usually given as > 1/SampleLength, so in this case .5 Hz. Now my sampling device can make > recordings of with up to 2048 Hz sample rate, so I imagined that with a high > enough sample rate, there should be a way to disciminate a 8.5Hz wave from a > 8.6Hz wave (we are looking at the peak energy in different ranges from 3 to > 7, 7 to 13 and 13 to 20 Hz. So I came up with an algorithm that lays a sine > and a cosine wave over the sample with frequencies from 3 to 20 in steps of > .1Hz and stores the summation in an array. That seems to give some increase > in resolution, only for a single signal in the source, (eg. in source 8.3 hz > gives a peak energy at 8,3 hz exactly); when i mix two waves, the maximum > distance over which they show up separately is about .3 Hz, then the peaks > fuse. > > DLLIMPORT long __stdcall MyFFT (long lNin, double dInArray[], long lNout, > double dOutArray[], double dFromHz, double dToHz, double dResolution, double > dSampleRate) > { > > &#4294967295; &#4294967295; long i,j ; > &#4294967295; &#4294967295; double d, f, s, z ; > &#4294967295; &#4294967295; double re[lNout] ; > &#4294967295; &#4294967295; double im[lNout] ; > > &#4294967295; &#4294967295; s = 0.0; > > &#4294967295; &#4294967295; for (i = 0; i<lNout; i++) > &#4294967295; &#4294967295; { > &#4294967295; &#4294967295; &#4294967295; &#4294967295; d = i * dResolution + dFromHz; > &#4294967295; &#4294967295; &#4294967295; &#4294967295; re[i] = 0.0; > &#4294967295; &#4294967295; &#4294967295; &#4294967295; im[i] = 0.0; > &#4294967295; &#4294967295; &#4294967295; &#4294967295; f = (d * 2.0 * PI) / dSampleRate; > &#4294967295; &#4294967295; &#4294967295; &#4294967295; for (j = 0; j<lNin; j++) > &#4294967295; &#4294967295; &#4294967295; &#4294967295; { > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; z = j * f; > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; re[i] += dInArray[j] * cos(z); > &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; &#4294967295; im[i] += dInArray[j] * sin(z); > &#4294967295; &#4294967295; &#4294967295; &#4294967295; } > &#4294967295; &#4294967295; &#4294967295; &#4294967295; dOutArray[i] = &#4294967295;sqrt(re[i] * re[i] + im[i] * im[i]); > &#4294967295; &#4294967295; } > > &#4294967295; &#4294967295; return 0; > > } > > My question, is there a way to take a spectrum with a certain given > resolution (res Hz) when the samplelength is fixed (sl seconds) and the > samplerate (sr Hz) can be adjusted? > The idea is, that the things we are searching for last not so long, maybe a > few seconds, so that taking a longer samplelength would average that thing > out. Are "WaveLets" something that i should study for this purpose? > > Looking forward to your reply, > Marc Kroeks.
The best method of estimating frequencies of this kind of signal is to estimate time varying Autoregressive (AR) parameters and then convert to the frequency domain. See G. Kitagawa and W. Gersch, A Smoothness Priors Long AR Model Method for Spectral Estimation," IEEE Trans. Automatic Contr., vol. AC-30, no. 1. pp 57-65, Jan 1985
On 30 Aug, 13:47, jacko <jackokr...@gmail.com> wrote:
> Prior art politeness would imply a <yourname>-jaxon-gaussian-heavyside- > fourier naming to your methods. ;-)
How about a nice brick wall filter at quater sample rate, and switch samples to make all frequencies below f/4 double in frequency, giving twice the resolution? cheers jacko
I always thought brain waves could be seen 'quick and dirty'

lol
It would be good to get back to basics.  i.e. fundamental physics.

Increasing the *time sample rate/distance* by itself, increases the 
*frequency span* of the spectrum.
(I'm assuming a DFT here).

Let's just keep this one fact in mind now as we look at the next fact....

Increasing the *time span* of the samples by itself, decreases the frequency 
*sample rate/distance*.
Said another way: it increases the number of samples in the *frequency span* 
[that is determined by the *time sample rate* from above].

It's easy to draw cartoons that make this visually evident.

So, the time span and the time sample rate, as you know, are unrelated and 
independent of one another.

The time span of the samples determines the spacing between frequency 
samples.  As Rune mentions, sometimes we handily refer to this as 
"resolution".

As far as the idea of adding "test" sinusoids of different frequencies to 
the signal being analyzed in order to somehow improve frequency estimation, 
consider this:

Start with a continuous, infinite signal with noise.
Add a continuous, infinite "test" sinusoid.

Chop out a finite time span of the composite signal.
This is the same as convolving in frequency with a sinc.  So, if the time 
span is short then the sinc is wide.  And, if the sinc is wide enough in its 
main lobe to encompass both signals then they will be smeared together.

The method you used is much like a DFT except you chose to integrate with 
different frequency kernels - if I understand your code.  I don't see how 
this is different from computing a complete DFT by zero padding in time 
(interpolating in frequency) and looking for the peak.

No matter:
Check out Erik Jacobsen's page:
http://home.comcast.net/~kootsoop/EricJ/index.htm

Fred