Evaluating and graphing functions in Matlab
- by thiol3
New to programming, I am trying to graph the following Gaussian function in Matlab (should graph in 3 dimensions) but am making some mistakes somewhere. What is wrong?
sigma = 1
for i = 1:20
for j = 1:20
z(i,j) = (1/(2*pi*sigma^2))*exp(-(i^2+j^2)/(2*sigma^2));
end
end
surf(z)