How to fourier transform a gaussian curve?

조회 수: 9(최근 30일)
Antonio Sarusic 26 Feb 2020
댓글: Star Strider 27 Feb 2020
Hello,
I have the following function:
x_fit_func(x) = a1*exp(-((x-b1)/c1).^2);
a1, b1 and c1 are all constants and the function represents a gaussian curve.
Now I want to fourier transform this function and in theory i should again get a gaussian curve.
I tried it like this
x_F = fft(x_fit_func(x));
or like this
x_F = fft(x_fit_func);
But it always calculates something that is not a gaussian curve.
Does anyone know what I do wrong?
Thanks
Antonio

로그인 to comment.

채택된 답변

Star Strider 26 Feb 2020
The ‘x_fit_fcn’ is not syntax that MATLAB recognises (except in the Symbolic Math Toolbox), as a function.
x_fit_func = @(x) a1*exp(-((x-b1)/c1).^2);
I also calculated the fft of the result tthat produced. It works.

댓글 수: 4

표시 이전 댓글 수: 1
Star Strider 27 Feb 2020
Sure!
Here is the code I used to test it:
a1 = 2;
b1 = 5;
c1 = 3;
x_fit_func = @(x) a1*exp(-((x-b1)/c1).^2);
x = linspace(-10, 10, 50);
x_F = fft(x_fit_func(x))/numel(x);
Fs = 1/mean(diff(x));
Fn = Fs/2;
Fv = linspace(-1, 1, numel(x_F))*Fn;
Iv = 1:numel(Fv);
figure
plot(Fv, fftshift(abs(x_F)))
grid
It first calculates the Gaussian with ‘x_fit_func’ inside the fft call, then plots the result.
Antonio Sarusic 27 Feb 2020
Thank you very much!
Star Strider 27 Feb 2020
As always, my pleasure!

로그인 to comment.

추가 답변(0개)

이 질문에 답변하려면 로그인을(를) 수행하십시오.

Translated by