title: DFT Matlab function
body: <p>I've write a function that calculates the DFT of an image, My prupose is to show the amplitude spectrum without using the fftshift command. DFT_img.m looks like this:</p>
  
  <pre><code>function f = DFT_img(a);
    [n m]=size(a);
    for i =1:n
      k=1;
      for j =1:n
        l=1;
        F(i,j)=(1/n*n)*a(i,j)*exp(-i*2*pi*(k*i+l*j)/n);
        l=l+1;
      end
      k=k+1;
    end
    f=F;
  </code></pre>
  
  <p>And when i write in Command Window the commands</p>
  
  <pre><code>A = imread("lena.tiff");
  ans = DFT_img(A);
  spectrum = log(abs(ans));
  mesh(spectrum)
  </code></pre>
  
  <p>i am not getting the same result that </p>
  
  <blockquote>
    <p>fftshift matlab function</p>
  </blockquote>
  
  <p>does !!!
  Am i having a mistake in the function, or where is the problem with that ?</p>