Matlab - FFT of Gaussian - Equivalency

Simple equivalency problem:
I plot out a 2D Gaussian function with a certain resolution in Matlab. i.e.
Y = normpdf(X,mu,sigma) % over some resolution with the peak in the center
Let's call the result g1FFT.
I am testing with mu = 0.0 (always), and variance or sigma = 1.0. I want to compare it to the result of FFT(Gaussian), which should result in another Gaussian with a variance of (1./sigma).
i.e.
g1FFT = circshift(g1FFT, [rows/2, cols/2, 0]); % fft2 expects center to be in corners
freq_G1 = fft2(g1FFT);
freq_G1 = circshift(freq_G1, [-rows/2, -cols/2, 0]); % shift back to center, for comparison sake
Since I am testing with sigma = 1.0, I would think that I should get two equivalent, 2D kernels, because if sigma = 1.0, then 1.0/1.0 = 1.0. So, g1FFT would equal freq_G1.
However, I do not get equivalent kernels. They have different magnitudes, even after normalization. Is there something I am missing?
Attached are cross-sections of the two kernels that I am talking about. Original sigma = 1.0 so that, even in the frequency-domain, the resulting sigma is also 1.0.

回答(1 个)

I'm not sure what you're intending to do.
Do you know about fftshift() command?
To me it sounds like you're having problem comparing the frequency domain result with time domain result. If this is your problem then have a look at fftshift command in MATLAB documentation.

6 个评论

Thanks for your response. Since the Fourier Transform of a Gaussian is, itself, a Gaussian, I am trying to compare a gaussian to fft(gaussian) with sigma = 1.0. If I am thinking about this right, they should look the same. (Besides having to shift the centers to be in the same place. Ignore that.)
As you mentioned they should look the same, fft of a gaussian signal is gaussian too.
I thought the only think that stops you to observe that is the fact that you need to shift the fft values, which fftshift does.
So you are aware of fftshift but yet that does not help you!?! Is it so?
Right, the problem is not about shifting the kernels to align; I'm already doing that.
Dear Kd.
Would you please post some images of this discrepancy?
I'm suspecting that the gaussian signal is not reached zero level and as a result of that you see some vanishing frequencies in frequency spectrum of the signal.
Is it so!?
Thanks for your input. I'm still not sure about it. Attached are cross-sections of the two (normalized) kernels now, and as you can see, their magnitudes are different.
You're kind of right. I don't know about this! I tried with my own sample and it's the same for me. except I got a different magnitude for a gaussian of amplitude 1.
x = -100:0.01:100;
g = gaussmf(x,[1,0]); % this needs fuzzy toolbox
plot(x,g);
figure
plot(fftshift(abs(fft(g))./numel(g)));
Why don't you search about the magnitude of fft, maybe what we see is correct!
let me know about it as well please.
Tnx

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

产品

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by