title: I want to use MATLAB fft2 function for electromagnetic wave propagation
body: <p>I want to do EM (ELECTROMAGNETIC) wave propagation by</p>
  
  <ol>
  <li>find the field Fourier transform in plane z==d ,  <code>A = fft2(F(x,y,d))</code> </li>
  <li>PS(phaseshift)  <code>kz = k^2 -(kx^2+ky^2)</code> where <code>kx = 2*pi*1/dx ,ky = 2*pi*1/dy</code> </li>
  <li><code>C = IFFT2(A*EXP(i*PS)</code></li>
  </ol>
  
  <p>but I dont get the expected result and I think I am confusing the FFT output arrangement and the way I define arrangement of kx and ky </p>
  
  <p>any clue appreciated. </p>
  
  <p>the flow chart is like :
     1.Calculate field on z==d</p>
  
  <p>2.Take Fourier 2D  transform of the field at z ==d =====> F(Kx,Ky,d) 
   where ,</p>
  
  <pre><code> kx = 2*pi*fx , fx = 1/dx
   ky = 2*pi*fy , fy =1/dy
   kz = k^2 – (kx^2+ky^2)
  </code></pre>
  
  <p>3.Take inverse fourier transfom of <code>(F(Kx,Ky,d)*exp(i*kz*(Z-d)))</code>  @ Z == d1 when d1 >d to find the  total field in z == d1
     This happens for z = d1,d1,…..,dn </p>
  
  <p>However I am confused about the frequency arrangement for output of fft and the way I am defining the spacial frequency (kx and Ky) are consistent. </p>