fft - How FFT2 is computed in Matlab -
so have matrix m=(50,50,250) , want fft2 of slices s=(50,50) along 3rd dimension = 250.
let's
ft = fftshift(fft2(m));
is calculating ft want?
because in function description says function returns 2-d dft each higher dimensional slice of x. example, if size(x) = [100 100 3], fft2 computes dft of x(:,:,1), x(:,:,2) , x(:,:,3).
so, assuming computing ft of slices s=(50x250) along 1st dimension = 50.
can clear me?
i think quite clear documentation. fft2
computes 250 2d dfts, 1 each of 50x50 slices in m. ft(:, :, i) 2d dft of m(:, :, i). behaves same as:
ft = zeros(size(m)); = 1 : size(m, 3) ft(:, :, i) = fft2(m(:, :, i)); end
you verify follows (error
should small):
ft1 = fft2(m); error = norm(abs(ft1(:) - ft(:)));
however, behavior of fftshift
not consistent want. should instead use second argument of fftshift
shift result along specific dimensions (1 , 2 in case):
ft = fftshift(fftshift(fft2(m), 1), 2);
Comments
Post a Comment