fft2 doesnot work correct.
Afficher commentaires plus anciens
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)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Fast Fourier Transforms dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
