title: How to calculate 1D power spectrum from 2D noise power spectrum by radial averaging
body: <p>guys I am trying to calculate 1D power spectrum from 2D FFT of the image. I did it with horizontal averaging but by looking at a graph it's not making me sense. Can you please suggest how to do radial averaging over 2D data set to reach 1D representation of noise power spectrum. Thank you 
  I will appreciate your help. </p>
  
  <p>Here is my code
  $</p>
  
  <pre><code> fid = fopen('C:\Users\3772khobrap\Desktop\project  related\NPS_cal_data_UB\100000006.raw','r');
  img = fread(fid,[512 512],'uint16');
  roi = zeros(64);
  avg = zeros(64);
  Ux= 0.0075;% Pixel size
  Uy = 0.0075;% Pixel size
  %% This block of code is subdividing imaage into smaller ROI and averaging purpose
  for r = 1:8 
      r_shift = (r-1)*64;
      for c = 1:8 
          c_shift = (c-1)*64;
          for i = 1:64 
              for j = 1:64
                  p = img(i+r_shift,j+c_shift);
                  roi(i,j) = p;
              end
          end
          avg = avg+roi;
      end
  end
  avg = avg./64;
  %%Actual process of NPS calculation
  scale = (Ux*Uy)./(64*64);%Scaling fator as per NPS calculation formula
  f_x = 1/(2*Ux);%Nyquiest frequecy along x direction
  f_y = 1/(2*Ux);%Nyquiest frequecy along y direction
  FFT_2d = (fftshift(fft2(avg))).^2;% Power spectrum calculation
  NPS = abs(FFT_2d).*scale; %% 2D NPS 
  f = linspace(-f_x,f_y,64);% x-axis  vector for 1D NPS 
  X_img = linspace(-f_x,f_x,512);% X axis of NPS image
  Y_img = linspace(-f_x,f_x,512);% Y axis of NPS image
  
  figure(1)
  subplot(2,2,1)
  imagesc(X_img,Y_img,img)
  colormap gray
  xlabel('X [cm]'); ylabel('Y [cm]')
  title('noise image')
  subplot(2,2,2)
  imagesc(f,f,log(NPS))
  colormap gray
  xlabel('frequency [cm^{-1}]'); ylabel('frequency [cm^{-1}]');
  title('2D NPS')
  subplot(2,2,3)
  plot(f_p,NPS(:,32))
  xlabel('frequency [cm^{-2}]'); ylabel('NPS [cm^{-2}]')
  title('1D NPS from central slice')
  subplot(2,2,4)
  plot(f_p,mean(NPS,2))
  xlabel('frequency [cm^{-2}]'); ylabel('NPS [cm^2]')
  title('1D NPS along X direction')
  </code></pre>