[nSLUG] Possibly ignorant quest for simple FFT app

Jack Warkentin jwark at bellaliant.net
Fri Jul 12 17:43:21 ADT 2013


Hi Mike

Well ... this takes me back more decades than I care to think about. All 
I can do is point you in a direction for further investigation, and 
point you away from a blind alley.

First, there is a clear distinction between a Fourier *series* (right 
direction) and a Fourier *transform* (blind alley). The *series* is as 
you have outlined in your

 >     inf
 >    SIGMA  A sin(nt) + B cos(nt)  [where A & B are subscripted with n]
 >     n=1

formula. The *transform* represents a function by an integral instead of 
a series. What you want is definitely the *series*. So avoid looking 
both for Fourier transform calculations, and for FFT, which stands for 
Fast Fourier Transform.

Disclaimer: I was never subjected to the Fourier transform during my 
many years of education. If somebody more knowledgable than I says you 
*do* want to look at Fourier transforms, I will certainly bow to his/her 
better judgment.

Digression: I am sure you are familiar with so-called "linear 
regression", where a straight line is fitted to a set of data by the 
method of "least squares". What "least squares" means is, the sum of the 
squares of the differences between the actual data points and the values 
predicted by the straight line is minimized.

Linear regression is an example of curve fitting. You want to do a 
different kind of curve fitting. I remember from my undergraduate days 
that we learned how to do least squares curve fitting of Fourier series 
to a set of data points. That is what I recommend you look at further.

I did a short web search on

"least squares" "curve fitting" Fourier

(using duckduckgo, not google) and discovered lots of possibilities. GNU 
Plot looked especially promising.

HTH.

Jack


Mike Spencer wrote:
>
> Summary: Looking for Fourier software simpleminded enough for me to be
>           able to use it.
>
> I have a basic, possibly horribly distorted, idea of what a Fourier
> transform does: You can make believe that:
>
>         +  any list of numbers are the amplitudes of one cycle of a
>            hypothetical periodic function for even-spaced values of t,
>            or that
>
>         +  any list of pairs of numbers are the t/amplitude values for
>            one cycle of a hypothetical periodic function.
>
> And Fourier's insight says that any periodic function can be
> represented as an infinite series of sums, vaguely like:
>
>         inf
>        SIGMA  A sin(nt) + B cos(nt)   [where A&  B are subscripted with n]
>         n=1
>
> Yeah... [1]
>
> I'd like a simple command line program that will take an arbitrary
> array of numbers or x/y number pairs and return the A&  B coefficients
> up to some modest max value for n.
>
> What I find on the net is one of:
>
>        +  FFT libraries for which I have to write surrounding code.
>
>        +  Interactive apps for serious DSP guys.
>
>        +  Apps for serious math weenies.
>
> all of which seem to start out assuming I know waayyy more than I do
> (viz. very little) about the subject and don't promise to give me the
> simple results sought.
>
> Purpose is to look for frequency patterns (if any) in putative random
> numbers and also -- even more frivolously -- in the recordings made
> from the mouse exercise-wheel tachometer. [2]
>
> I recall seeing graphic rendering of data from (what I took to be)
> such a Fourier program on the screen of a guy who was doing hard-core
> random number research for crypto.  I've lost track of him.
>
>
> Maybe I'm so ignorant in this area that this is all too misguided for
> a meaningful reply.  In that case you can just treat this as idle
> entertainment on a slow day for the NSLUG list.
>
>
> - Mike
>
>
> [1] ...the real equation with discussion is in my old calculus
>      textbook.  I'm weak on math and it doesn't get better with age.
>      Not looking for a tutorial on Fourier math or FFT code.
>
> [2] Our mouse slacked off all winter but resumed using the wheel in
>      the spring and I've logged over 30 evenings of running. Record is
>      16,000+ turns of the wheel or about 4.8 miles in one evening.
>      Visualizing the data requires an image 480x24000 pixels which
>      gnuplot does nery nicely. :-)
>

-- 
Jack Warkentin, phone 902-404-0457, email jwark at bellaliant.net
39 Inverness Avenue, Halifax, Nova Scotia, Canada, B3P 1X6


More information about the nSLUG mailing list