How to fourier transform a gaussian curve?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Antonio Sarusic
le 26 Fév 2020
Réponse apportée : DISHANTKUMAR PATEL
le 1 Déc 2022
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
0 commentaires
Réponse acceptée
Star Strider
le 26 Fév 2020
The ‘x_fit_fcn’ is not syntax that MATLAB recognises (except in the Symbolic Math Toolbox), as a function.
Try this versiion instead:
x_fit_func = @(x) a1*exp(-((x-b1)/c1).^2);
I also calculated the fft of the result tthat produced. It works.
4 commentaires
Plus de réponses (1)
DISHANTKUMAR PATEL
le 1 Déc 2022
% isotropic Gaussian parameters n = 65; % resolution s = 2; % width x = linspace(-5,5,n); [X,Y] = meshgrid(x); gaus2d = exp( -(X.^2 + Y.^2 )/(2*s^2)); figure(1), clf surf(x,x,gaus2d) rotate3d on hold on % adjusting the radius of sphere x1 = x1*s; y1 = y1*s; z1 = z1; % add a constant to sphere, so that it is on top of gauss addi = max(gaus2d(:)) - min(z1(:)); z1 = z1 + addi; surf(x1,y1,z1) realCenter = [8,15,25]; [X,Y,Z] = sphere; XYZ = bsxfun(@plus,r*[X(:),Y(:),Z(:)], realCenter) % Label axes. xlabel('X', 'FontSize', 8); ylabel('Y', 'FontSize', 8); zlabel('Z', 'FontSize', 8); title('3D Sphere'); axis equal;
0 commentaires
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!