title: My fft2 function not work with me
body: <p>I faced a problem when I convert these two statements from build in to my own function:</p>
  
  <pre><code>gaus=gauss/sum(gauss(:));
   BeforeAbs=fft2(gaus,size(im,1),size(im,2));
  </code></pre>
  
  <p>And it gave me [Attempted to access X(2); index out of bounds because numel(X)=1] </p>
  
  <pre><code> %--------Start convert from build in to my own function of Fourier transformation of 1 D
              gaus=gauss/sum(gauss(:));
  
              for u=1:(gaus)
              summ=0;
              for x=1:1
              w2=(-1*(sqrt(-1)))*2*pi*((u*x)/(gaus+1))
              summ=summ+(gaus(x)*exp(w2)); 
              end
              PQ2(u)=summ;
              end% 
  
  
         X=size(im,1);
         for u=1:(X)
              summ=0;
            for x=1:1
                 w3=(-1*(sqrt(-1)))*2*pi*((u*x)/(X+1))
                 summ=summ+(X(x)*exp(w3)); 
            end
              PQ3(u)=summ;
         end
  
  
       BeforeAbs=[PQ2 PQ3];
  </code></pre>
  
  <p>Can anyone tell me why this error appears with me?</p>