Plot an Gaussian function..

2 次查看(过去 30 天)
Lizan
Lizan 2012-10-23
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

采纳的回答

Image Analyst
Image Analyst 2012-10-23
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 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by