Problem with ploting exp function
이전 댓글 표시
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
Alberto Cuadra Lara
2022년 5월 2일
Hello Dinh,
The function looks good. Are you using the same limits in Geogebra?
Dinh Le Dung
2022년 5월 3일
Walter Roberson
2022년 5월 3일
Very different plotting ranges.
Dinh Le Dung
2022년 5월 3일
채택된 답변
추가 답변 (1개)
Catalytic
2022년 5월 2일
If I had to guess, you have x and y reversed.
[X, Y] = ndgrid(x, y);
surf(X, Y, t(X,Y));
카테고리
도움말 센터 및 File Exchange에서 Annotations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


