I thought you (amongst others) might like that URL.
It is Dave Minter's mirror of the SSCCE. Thanks Dave!
--
Andrew T.
Reply by dbd●April 24, 20082008-04-24
On Apr 24, 1:16 pm, glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote:
> Jerry Avins wrote:
>
> (snip)
> > snip
> It does make some sense in the context of the FFT, though.
> Since FFT has periodic boundary conditions, the lowest non-zero
> frequency could be considered the fundamental.
In the OP's description, 500 Hz is the lowest non-zero frequency :,).
And it is the 'fundamental of the signal', as opposed belonging to the
set of 'fundamental frequencies of the transform', of which zero is
included as a member.
Does anyone have a suggestion for a description of this area of
vocabulary that is:
1) accessible (free, etc.)
2) complete enough for this level of discussion
3) unambiguous
4) at a suitable level for the OP?
> Those who
> apply the FFT to non-periodic signals get what they deserve.
>
Those who have known how to apply the FFT to non-periodic signals have
made much good use of it.
> -- glen
Dale B. Dalrymple
Reply by glen herrmannsfeldt●April 24, 20082008-04-24
Jerry Avins wrote:
(snip)
> It would help if you used the same terms that the rest of us do. In
> particular, it is important to avoid using standard words in
> non-standard ways without the sort of glossary you provided here.
> *Fundamental* applies not to an FFT, but to the longest-period component
> of a periodic waveform. What *you* have called the fundamental is often
> referred to as bin width or resolution.
It does make some sense in the context of the FFT, though.
Since FFT has periodic boundary conditions, the lowest non-zero
frequency could be considered the fundamental. Those who
apply the FFT to non-periodic signals get what they deserve.
> If your signal repeats every 2 ms, then its fundamental is 500 Hz. It
> may have harmonics at 1000, 1500, 2000Hz, etc.
-- glen
Reply by Nigel Wade●April 24, 20082008-04-24
Lew wrote:
> cpptutor2000@yahoo.com wrote:
>> On Apr 22, 11:04 pm, Lew <l...@lewscanon.com> wrote:
>>
>>>> fs = sample rate in Hz
>>>> dT = 1/fs = interval between samples
>>>> N = number of samples taken
>>>> T = N x dT = total time period
>>>> f1 = 1/T = frequency of the first harmonic in Hz
>>> So if you accumulated twice as many samples, over twice as long, your
>>> fundamental frequency would be halved? That is not sensible.
>>>
>>> --
>>> Lew
>> That is precisely the case. Please check the definitions above. Please
>> note that f1 is the first harmonic if I were to calculate an FFT with
>> the collected samples. The fundamental frequency is 500.0 Hz, and
>> stays that way.
>
> No, that doesn't make sense. If I recorded a pure 1000 Hz sine wave, that is
> the frequency whether I take 44000 samples for one second or 88000 samples
> over two seconds. The frequency isn't affected by how long I record it.
>
The frequency *resolution* is, though. That's what the OP was referring to
[rather obliquely]. The OP mistakenly calls this the fundamental frequency.
The sampling rate determines the bandwidth, and the maximum freq. which you can
capture (Nyquist-Shannon). The overall length (in time, not samples) determines
the frequency resolution (Fourier).
--
Nigel Wade
On Apr 23, 2:48�pm, "cpptutor2...@yahoo.com" <cpptutor2...@yahoo.com>
wrote:
> With reference to all the postings I am sorry I have caused confusion..
One way to 'cut through the c..onfusion' is to post an
SSCCE. More info here
http://sscce.org/
Have one peice of code to generate the tone,
and a second to do the transform.
--
Andrew T.
Reply by Lew●April 24, 20082008-04-24
Jerry Avins wrote:
> cpptutor2000@yahoo.com wrote:
>> With reference to all the postings I am sorry I have caused confusion
>> about what I meant by the 'fundamental frequency' etc., May I give a
>> simple example?
>>
>> For a given signal being sampled for analysis, the number of points
>> obtained and the time between samples combine to determine the total
>> length of time taken to examine the signal. The following definitions
>> apply:
>> fs = sample rate in Hz
>> dT = 1/fs = interval between samples
>> N = number of samples taken
>> T = N x dT = total time period
>>
>> f1 = 1/T = frequency of the first harmonic in Hz
>> Keeping these points in mind, I have found that f1 in my case is
>> around 7 Hz. I am NOT measuring 7 Hz. If I were to take an FFT of the
>> collected data, then I can expect to get peaks that are harmonics of 7
>> Hz. That is if I were to detect if the 500.0 Hz signal of the tone
>> generator was being picked up, I would have look for the 500/7
>> harmonic of 7 Hz. I hope I have made myself clear about what I am
>> trying to do.
>
> Pete,
>
> It would help if you used the same terms that the rest of us do. In
> particular, it is important to avoid using standard words in
> non-standard ways without the sort of glossary you provided here.
>
> *Fundamental* applies not to an FFT, but to the longest-period component
> of a periodic waveform. What *you* have called the fundamental is often
> referred to as bin width or resolution.
>
> If your signal repeats every 2 ms, then its fundamental is 500 Hz. It
> may have harmonics at 1000, 1500, 2000Hz, etc.
No wonder I was confused. It was a case of, "There's glory for you!"
(Carroll, Lewis, /Through the Looking-Glass/, Chapter VI, "Humpty Dumpty",
<http://www.gutenberg.org/etext/12>).
--
Lew
Reply by Lew●April 24, 20082008-04-24
cpptutor2000@yahoo.com wrote:
> On Apr 22, 11:04 pm, Lew <l...@lewscanon.com> wrote:
>
>>> fs = sample rate in Hz
>>> dT = 1/fs = interval between samples
>>> N = number of samples taken
>>> T = N x dT = total time period
>>> f1 = 1/T = frequency of the first harmonic in Hz
>> So if you accumulated twice as many samples, over twice as long, your
>> fundamental frequency would be halved? That is not sensible.
>>
>> --
>> Lew
> That is precisely the case. Please check the definitions above. Please
> note that f1 is the first harmonic if I were to calculate an FFT with
> the collected samples. The fundamental frequency is 500.0 Hz, and
> stays that way.
No, that doesn't make sense. If I recorded a pure 1000 Hz sine wave, that is
the frequency whether I take 44000 samples for one second or 88000 samples
over two seconds. The frequency isn't affected by how long I record it.
--
Lew
Reply by John E. Hadstate●April 23, 20082008-04-23
<cpptutor2000@yahoo.com> wrote in message
news:a1d43b38-854e-470e-adbf-e514cf982960@a70g2000hsh.googlegroups.com...
> On Apr 23, 4:18 am, "John E. Hadstate" <jh113...@hotmail.com>
> wrote:
>
>> Even (especially) after reading your later post, I don't
>> understand what you are saying. From your later post, it
>> seems
>> that 7 Hz is your bin resolution, so the first bin
>> corresponds
>> to 7 Hz, the 2nd to 14 Hz, etc. Are you saying that you
>> don't
>> see a spike near bin 71 (500/7)? Perhaps the amplitude of
>> your
>> injected tone is too low compared to the amplitude of your
>> other signal (so the spike is there, it's just lost in the
>> noise). What exactly is the problem?
>
> The problem is, as I mentioned in a posting just before, that
> when I
> plot the data, I see a long sequence of zeros, about 250 -
> 300 sample
> points long, before I see the sinusoidal signal. There are a
> few sharp
> and large spikes at the start, which might be due to DC
> offset, but I
> do not understand the sequence of zeros. The total sample
> size of the
> collected data is 2048.
>
I'll second Ron's motion and add that some file formats that
I'm familiar with reserve the first 512-byte block (or more)
for "metadata"; that is, special labels that identify things
about the data like the sample rate, the number of bits per
sample, the endian-ness, whether stereo or mono, the number of
channels, etc. Since these things don't often consume all the
allocated space, the remaining bytes ("reserved for future
expansion" is a favorite phrase here) are often set to zero.
As long as identifiable data starts at a constant offset from
the beginning of the file and assuming that you don't need the
metadata, my advice would be to read it and discard it.
Reply by Jerry Avins●April 23, 20082008-04-23
Jerry Avins wrote:
cpptutor2000@yahoo.com wrote:
> On Apr 23, 4:18 am, "John E. Hadstate" <jh113...@hotmail.com> wrote:
>
>> Even (especially) after reading your later post, I don't
>> understand what you are saying. From your later post, it seems
>> that 7 Hz is your bin resolution, so the first bin corresponds
>> to 7 Hz, the 2nd to 14 Hz, etc. Are you saying that you don't
>> see a spike near bin 71 (500/7)? Perhaps the amplitude of your
>> injected tone is too low compared to the amplitude of your
>> other signal (so the spike is there, it's just lost in the
>> noise). What exactly is the problem?
>
> The problem is, as I mentioned in a posting just before, that when I
> plot the data, I see a long sequence of zeros, about 250 - 300 sample
> points long, before I see the sinusoidal signal. There are a few sharp
> and large spikes at the start, which might be due to DC offset, but I
> do not understand the sequence of zeros. The total sample size of the
> collected data is 2048.
Look to the acquisition software. It's unlikely that there's a startup
transient that large in the hardware, but there may be an offset
between the pointers that write and retrieve the data.
Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������