Next: TWO-DIMENSIONAL FT Up: SLOW PROGRAM FOR INVERTIBLE Previous: SLOW PROGRAM FOR INVERTIBLE

The slow FT code

The slowft() 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 slowft( adj, add, t0,dt,tt,nt,  f0,df,  ff,nf)
complex cexp, cmplx,               tt(nt),         ff(nf)
real pi2, freq, time, scale, t0,dt,        f0,df
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)

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 radians per sample unit or Hz. Dividing the total interval by the number of points nf gives .We could choose the frequencies to run from 0 to 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 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: TWO-DIMENSIONAL FT Up: SLOW PROGRAM FOR INVERTIBLE Previous: SLOW PROGRAM FOR INVERTIBLE
Stanford Exploration Project
3/1/2001