Plot an Gaussian function..
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I am trying to plot a 2D/3D plot of a Gaussian function but I am having some issues. I don't see a Gaussian.. anyone that can help?
Example:
X_pixel = 2500; Y_pixel = 2000;
A = 100;
x0 = X_pixel/2;
y0 = Y_pixel/2;
sigma_x = 25e-6;
sigma_y = 0.5e-6;
for theta = 1:pi/4:pi
disp('plot')
[X, Y] = meshgrid(0:1:(X_pixel), 0:1:(Y_pixel));
Z = A*exp( - (((X-x0).^2)/(2*(sigma_x^2)))) - (((Y-y0).^2)/(2*(sigma_y^2)))) ;
figure
surf(X,Y,Z);
colormap(cool)
shading interp;
colorbar
%view(90,90);
axis equal;
drawnow
end
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 23 Okt. 2012
Your parentheses in Z are messed up (not matching) and your sigmas (100^-6) are way way too small to be seen for x going from 0-2500. Try something like 500 or so.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!