hello ty for your attention
im a newcommer
i want a plot3 for this function but im confused and don't know what to do
z=y*exp(-x^2-y^2)
-3<=x,y<=3
I would be grateful if you guide me through this.

 Accepted Answer

Try meshgrid and linspace :
% -3<=x,y<=3
numElements = 200;
X = linspace(-3, 5, numElements);
Y = linspace(-3, 3, numElements);
[x, y] = meshgrid(X, Y);
z = y*exp(-x .^ 2 - y .^ 2);
surf(x, y, z, 'EdgeColor', 'none');
colorbar;

More Answers (0)

Community Treasure Hunt

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

Start Hunting!