Drawing a 3-D graph, endpoint issues

2 次查看(过去 30 天)
Hello everyone,
I asked a question similar to this under the subject of linspace but I am re-posting it because this time I wanted to attach the photos. So that you can see clearly what my issue is.
The black/white graph(3dd.jpg) is what I am trying to draw and the graph in color(3d.jpg) is what I have drawn. I am not sure what I must modify to be able to successfully draw the black/white graph(3dd.jpg). I tried modifying the linspace values but I still couldn't achieve my goal.
Following is my code,
x=linspace(-2,2);
y=linspace(-2,2);
[X,Y] = meshgrid(x,y);
Z=(X.^2+3*Y.^2)*exp(-X.^2-Y.^2);
meshz(X,Y,Z)
Thank you very much.

采纳的回答

Star Strider
Star Strider 2016-5-8
Please clarify what you want.
This code:
x=linspace(-2,2);
y=linspace(-2,2);
[X,Y] = meshgrid(x,y);
Z=(X.^2+3*Y.^2).*exp(-X.^2-Y.^2);
meshz(X,Y,Z)
produces this plot:
  4 个评论
verzhen Ligai
verzhen Ligai 2016-5-8
Nope! I realized what I did wrong! Thank you so much!!!!!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile 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