From: "Geoffrey" gmvoeth@...........

Date: Wed, 18 Jul 2007 01:30:56 -0700

WunderBar; I appreciate this since i am having great difficulty understanding it. It seems simple at first but i quickly get lost in the math and juggling of data. I will be sure to play with these ideas and show you results if they amount to anything. If I can get the conversion it is easy to build a BMP file of the results that can be universally shared. I have not yet been able to get a (self programmed) FFT to really work but have a nice little program called SPECTRA that Nuhertz will not let me have the source code. If I could get their code it would be an easy matter to tack on a recursive feature to build the lines of the display history. regards; geoff ----- Original Message ----- From:To: ; Sent: Saturday, July 14, 2007 18:46 Subject: FFT Code > Hi Geoff, > > I write my code in Visual Basic, and also have another FFT routine written > in QBasic. The code listing below is what I use in my FFTDemo program, which > you can access from _http://www.jclahr.com/science/psn/mcclure/index.html_ > (http://www.jclahr.com/science/psn/mcclure/index.html) > > Cheers, > > Bob > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Private Sub FFT(Z() As Single) > Inv = 0 > Call FT(Inv, Npwr, Z()) > End Sub > > > Private Sub IFT(Z() As Single) > Inv = 1 > Call FT(Inv, Npwr, Z()) > End Sub > > > Private Sub FT(Inv As Long, Npwr As Long, Z() As Single) > Dim PI As Single, Isi As Long, ex As Single > Dim I As Long, n As Long, J As Long, m As Long, Mmax As Long > Dim Ang As Single, wr As Single, wi As Single, tr As Single > Dim ti As Single, istep As Long > PI = 4# * Atn(1#) > Isi = -1 > If Inv > 0 Then Isi = 1 > n = 1 > For I = 1 To Npwr > n = 2 * n > Next I > J = 0 > For I = 0 To n - 2 > If I < J Then > ex = Z(0, I) > Z(0, I) = Z(0, J) > Z(0, J) = ex > ex = Z(1, I) > Z(1, I) = Z(1, J) > Z(1, J) = ex > End If > m = n / 2 > While m <= J > J = J - m > m = m / 2 > Wend > J = J + m > Next I > Mmax = 1 > While Mmax <> n > istep = 2 * Mmax > For m = 0 To Mmax - 1 > Ang = PI * Isi * m / Mmax > wr = Cos(Ang) > wi = Sin(Ang) > For I = m To n - 1 Step istep > J = I + Mmax > tr = wr * Z(0, J) - wi * Z(1, J) > ti = wi * Z(0, J) + wr * Z(1, J) > Z(0, J) = Z(0, I) - tr > Z(1, J) = Z(1, I) - ti > Z(0, I) = Z(0, I) + tr > Z(1, I) = Z(1, I) + ti > Next I > Next m > Mmax = istep > Wend > If Isi > 0 Then > For I = 0 To n - 1 > Z(0, I) = (1 / n) * Z(0, I) > Z(1, I) = (1 / n) * Z(1, I) > Next I > End If > End Sub > > > > > > ************************************** Get a sneak peak of the all-new AOL at > http://discover.aol.com/memed/aolcom30tour > __________________________________________________________ Public Seismic Network Mailing List (PSN-L)