MATLAB: How to plot “f(x,y) = e^-(x^2+y^2)” function in matlab

MATLABmatlab function

Undefined function or variable 'y'.
Error in Untitled (line 5)
y = exp(x.^2+y.^2);
my computer gives these errors and I do not know how to fix them.

Best Answer

Try this:
figure
fsurf(@(x,y)exp(-(x.^2+y.^2)), [-2 2 -2 2])