Hi Lester, If I understood properly, for an even number of spatial input grid points along Nx and Ny, with regular spacing dx and dy, I think k should be computed from:
kx = dkx*(-Nx/2+1:Nx/2); ky = dky*(-Ny/2+1:Ny/2); with: dkx = 1/Nx/dx; dky = 1/Ny/dy; Regards, Rafael -----Original Message----- From: users <[email protected]> On Behalf Of arctica1963 Sent: Thursday, July 26, 2018 3:54 PM To: [email protected] Subject: [Scilab-users] FFT - upward continuation of a 2D grid Hello all, A quick query regarding fft and wavenumber calculations. I am looking to do an upward contuation of a gravity data grid using fft and the basic equation: fft_Grav_up = fft2(gravity_input) * e^(-kz) // think it also needs fftshif to centre Zero? ... Upward_continued_gravity=ifft(fft_out_Grav_up) Where z = upward continuation distance and k = wavenumber k =sqrt(kx^2 + ky^2) Is there an easy way to get the wavenumber from the input? Before doing the fft, the grid would need padding on all edges, so I think this works unless there is a better method: dimx=size(xt) dimy=size(yt) // For FFT pad X,Y to 2*ncols, 2*nrows (large enough to avoid boundary effects) addedRows = dimy(1); addedCols = dimx(1); tmp = [Boug_corr; Boug_corr($, :).*.ones(addedRows, 1)]; tmp = [tmp tmp(:, $).*.ones(1,addedCols)]; tmp = [repmat(tmp(1, :), addedRows, 1) ; tmp]; Boug_corr_padded = [repmat(tmp(:,1), 1, addedCols) tmp] After running fft, the grid would then be clipped back to the correct size. If there is a simple code for doing this great! Thanks Lester -- Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html _______________________________________________ users mailing list [email protected] http://lists.scilab.org/mailman/listinfo/users _______________________________________________ users mailing list [email protected] http://lists.scilab.org/mailman/listinfo/users
