Evaluating and graphing functions in Matlab

Posted by thiol3 on Stack Overflow See other posts from Stack Overflow or by thiol3
Published on 2010-05-07T03:31:55Z Indexed on 2010/05/07 3:38 UTC
Read the original article Hit count: 224

Filed under:

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)

© Stack Overflow or respective owner

Related posts about matlab