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일

0 개 추천

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일
Oh wow, how come when I ran it, I got a different result? my result was as shown in the picture.
verzhen Ligai
verzhen Ligai 2016년 5월 8일
verzhen Ligai
verzhen Ligai 2016년 5월 8일
Nope! I realized what I did wrong! Thank you so much!!!!!
Star Strider
Star Strider 2016년 5월 8일
My pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Construction에 대해 자세히 알아보기

태그

질문:

2016년 5월 8일

댓글:

2016년 5월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by