fft2 doesnot work correct.
显示 更早的评论
HI,I do 2D Fourier of 2D rect and it does not return 2D sinc.
N = 2000; % number of grid points per side
L = 2e-3; % total size of the grid [m]
delta1 = L / N; % grid spacing [m]
D = 2e-3;% diameter of the aperture [m]
[x1 y1] = meshgrid((-N/2 : N/2-1) * delta1);
ap =ft2( rect(x1./D).*rect(y1./D),1);
surf(x1,y1,ap,'LineStyle','none')
function G = ft2(g, delta)
% function G = ft2(g, delta)
G = fftshift(fft2(fftshift(g))) * delta^2;
end
function y = rect(x, D)
if nargin == 1, D = 1; end
x = abs(x);
y = double(x<D/2);
y(x == D/2) = 1;
end
What did I do wrong?
And can somewane explain why i twice use fftshift in Fourier definition ( I took that function from book)
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Fast Fourier Transforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
