Plot an Gaussian function..

조회 수: 4 (최근 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에서 Annotations에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by