Next: Basics of two-dimensional Fourier Up: Waves and Fourier sums Previous: Shifted spectrum

# SETTING UP 2-D FT

The program fth() is set up so that the vectors transformed can be either rows or columns of a two-dimensional array. In any computer language there is a way to extract a vector (column or row) from a matrix. In some languages the vector can be processed directly without extraction. To see how this works in Fortran, recall a matrix allocated as (n1,n2) can be subscripted as a matrix (i1,i2) or as a long vector (i1 + n1*(i2-1),1), and call sub(x(i1,i2)) passes the subroutine a pointer to the (i1,i2) element. To transform an entire axis, the subroutines ft1axis() and ft2axis() are given. For a two-dimensional FT, we simply call both ft1axis() and ft2axis() in either order.
```# 1D Fourier transform on a 2D data set along the 1-axis
#
subroutine  ft1axis( adj, sign1, n1,n2, cx)
complex cx(n1,n2)
real sign1
do i2= 1, n2
call fth( adj, sign1, 1,n1, cx(1,i2))
return; end
```

```# 1D Fourier transform on a 2D data set along the 2-axis
#
subroutine  ft2axis( adj, sign2, n1,n2, cx)
complex cx(n1,n2)
real    sign2
do i1= 1, n1
call fth( adj, sign2, n1,n2, cx(i1,1))
return; end
```

Next: Basics of two-dimensional Fourier Up: Waves and Fourier sums Previous: Shifted spectrum
Stanford Exploration Project
12/26/2000