Problem with ploting exp function
Mostrar comentarios más antiguos
I try to plot t(x,y) = (x^2 - 2y^2)*e^(x-y) in Matlab and i use the following code
t=@(x,y)((x.^2-2*y.^2).*exp(x-y));
x = -1:2/50:1;
y = -2:4/50:2;
[X, Y] = meshgrid(x, y);
surf(X, Y, t(X,Y));
rotate3d on;
I got the result but it is not the same as i drawn in Geogebra
I think there is a problem with .*exp(x-y)
4 comentarios
Alberto Cuadra Lara
el 2 de Mayo de 2022
Hello Dinh,
The function looks good. Are you using the same limits in Geogebra?
Dinh Le Dung
el 3 de Mayo de 2022
Walter Roberson
el 3 de Mayo de 2022
Very different plotting ranges.
Dinh Le Dung
el 3 de Mayo de 2022
Respuesta aceptada
Más respuestas (1)
Catalytic
el 2 de Mayo de 2022
If I had to guess, you have x and y reversed.
[X, Y] = ndgrid(x, y);
surf(X, Y, t(X,Y));
1 comentario
Dinh Le Dung
el 3 de Mayo de 2022
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


