previous up next print clean
Next: SETTING UP THE FAST Up: INVERTIBLE SLOW FT PROGRAM Previous: INVERTIBLE SLOW FT PROGRAM

The simple FT code

The mple ft() routine exhibits features found in many physics and engineering programs. For example, the time-domain signal (which I call ``tt()"), has nt values subscripted, from tt(1) to tt(nt). The first value of this signal tt(1) is located in real physical time at t0. The time interval between values is dt. The value of tt(it) is at time t0+(it-1)*dt. I do not use ``if'' as a pointer on the frequency axis because if is a keyword in most programming languages. Instead, I count along the frequency axis with a variable named ie. 
subroutine simpleft( adj, add, t0,dt,tt,nt,  f0,df,  ff,nf)
integer it,ie,       adj, add,          nt,             nf
complex cexp, cmplx,                  tt(nt),         ff(nf)
real pi2, freq, time, scale,   t0,dt,        f0,df
call adjnull(        adj, add,       tt,nt*2,        ff,nf*2 )
                        pi2= 2. * 3.14159265;           scale = 1./sqrt( 1.*nt)
                        df = (1./dt) / nf
                        f0 =   - .5/dt  
do ie = 1, nf {   freq= f0 + df*(ie-1)
do it = 1, nt {   time= t0 + dt*(it-1)
        if( adj == 0 )
                ff(ie)= ff(ie) + tt(it) * cexp(cmplx(0., pi2*freq*time)) * scale
        else
                tt(it)= tt(it) + ff(ie) * cexp(cmplx(0.,-pi2*freq*time)) * scale
        }}
return; end

The total frequency band is $2\pi$ radians per sample unit or $1/\Delta t$ Hz. Dividing the total interval by the number of points nf gives $\Delta f$.We could choose the frequencies to run from 0 to $2\pi$ radians/sample. That would work well for many applications, but it would be a nuisance for applications such as differentiation in the frequency domain, which require multiplication by $-i\omega$including the negative frequencies as well as the positive. So it seems more natural to begin at the most negative frequency and step forward to the most positive frequency. Next, we must make a confusing choice.


previous up next print clean
Next: SETTING UP THE FAST Up: INVERTIBLE SLOW FT PROGRAM Previous: INVERTIBLE SLOW FT PROGRAM
Stanford Exploration Project
10/31/1997