I am having trouble understanding how to set up the grid in the Fourier domain, while performing Discrete Fourier Transforms. This might be a very trivial question, but I'd appreciate any help understanding this problem.
I am trying use Fourier transforms to model the propagation of an electric field through space. The steps that I need to perform are:
- Take the Fourier transform of $f(x, z = 0)$ to obtain $f(k, z=0)$
- Multiply $f(k)$ by $\exp[i\,k_z\,d]$ for some propagation distance $d$ with $i = \sqrt{-1}$. Here k_z is defined as:
$$ k_z = \sqrt{k^2 - k_x^2} $$ where $k$ is the known wavenumber.
- Inverse Fourier Transform back to obtain $f(x, z=d)$
I have set-up my grid for the x-dimension but I do not understand how I should go about setting up the grid for the k-dimension.
My approach (as obtained from the section on FFT in Computational Methods in Physics by Joel Franklin):
My $x$-grid is defined as $x_i = i\,\,dx$ for $i \in [0,N-1]$ for some number $N$. Now, I define the $k$ space with $k_j = j \times dk$ such that $dk=\frac{1}{dx \,\,N}$. This grid was created to obtain the max value of k allowed by Nyquist's theorem. Then, I execute the following:
(*fields is a list of the values of the field on the x-grid*)
klist = Table[n*dk, {n, -NN/2 , NN/2}];
four = Fourier[fields];
final= InverseFourier[
Table[four[[i]]*Exp[-I*d*Sqrt[k^2 - kxlist[[i]]^2]], {i, 1,
Length[four]}]];
The output of the above code does not give me expected results for the what the field looks like at various distances. I would appreciate any explanation about where the definitions of setting up the k-grid come from and also if someone can point out mistakes in my implementation.
Thanks
N
is a protected symbol (used for numerical conversion), so usen
instead. $\endgroup$ – DumpsterDoofus Aug 5 '14 at 21:12Exp[-I*d*Sqrt[k^2 - klist[[i]]^2]]
. Which one is correct? $\endgroup$ – DumpsterDoofus Aug 5 '14 at 22:25kz = Sqrt[k^2 - kxlist[[i]]^2]]
. Here, kxlist and kz represent the x and z components of the wavenumber k. I have made the edits to the question. $\endgroup$ – Sandesh Aug 6 '14 at 13:49