I have an issue getting the correct output for the Fourier transform of Gaussian exp(-2(x^2 + y^2). I know analytically that the Fourier transform should be 0.25 * exp(-0.125(k^2 + j^2)), where k and j are the Fourier variables, but the output of the absolute value of the FFT output doesn't match this. This is the analytic solution:
versus my output:
This is the relevant code:
Fs = 10; %space frequency
Dx = 1 / Fs; %sampling period
x = -10: Dx : 10; %space vector on domain [-10, 10], one dimensional
L = length(x); %length of signal
[X, Y] = meshgrid(x, x); %2D domain defined by the space vector x
U = exp(-2 *( X.^2 + Y.^2));
n = 2^nextpow2(L); %padding for FFT to optimize performance
U_hat = fft2(U, n, n); %FFT of the Gaussian
Dk = Fs*((-n/2):((n/2) - 1)) / n; %space frequency domain (ie, the fourier domain) in one dimension, shifted, rescaled by n
P = abs(fftshift(U_hat) / n); %power spectrum (ie | X_hat | = sqrt(X_hat * complex_conjugate(X_hat)), shifted
[K1, K2] = meshgrid(Dk, Dk); %Fourier domain
mesh(K1, K2, P);
title('Gaussian Pulse in Frequency Domain');
xlabel('Frequency (k_1)');
ylabel('Frequency (k_2)');
zlabel('|P(f)|');
Did I mess up making the frequency domain?
FourierTransform[Exp[-2(x^2 + y^2)], {x, y}, {k, l}]
. I know the Fourier transform of a Gaussian is another Gaussian, which is why I didn’t question the result. – dweeby