I do not know why this is not plotting the multivariable function correctly?

It do not know why MATLAB plots incorrectly the following function f(x,y) = x*(10y+3)*e^(-x^2-y^2)
This is the code I wrote:
x = -5:0.1:5;
y = -5:0.1:5;
[X,Y]=meshgrid(x);
syms x y;
f(x,y) = exp(-x.^2)*exp(-y.^2)*x*(10*y+3);
F = X*(10*Y+3)*(exp(-X.^2-Y.^2));
surf(X,Y,F);
f = (exp(-x.^2-y.^2))*(10*y*x+3*x); % This is not part of the question
set(gca,'FontSize',15)
xlabel('$x$','FontSize',20,'interpreter','latex');
ylabel('$y$','FontSize',20,'interpreter','latex');
title('$x*(10*y+3)*exp(-x^2-y^2)$','FontSize',15,'interpreter','latex');
And this is the output I got
Any ideas?

 采纳的回答

F = X.*(10*Y+3).*(exp(-X.^2-Y.^2));
instead of
F = X*(10*Y+3)*(exp(-X.^2-Y.^2));

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by