How do I fix my meshgrid?
古いコメントを表示
This is the code i have inserted and im getting this. Where is the mistake in my coding and how do I fix this?
gridspacing=-8:0.5:8;
Y=-8:0:8;
Z=-8:1.5:8;
[x,Y] = meshgrid (-8:0.5:8);
Z=sqrt(exp(-x.^2-Y.^2))
surf(x,Y,Z,x.*exp(Y))
Z(R==0)=1
z = sin (R)/R
4 件のコメント
Shubham Gupta
2019 年 10 月 24 日
What result were you expecting? Why are you defining gridspacing, Y & Z even though you are redefing Y & Z and not using gridspacing? You have not defined R?
Briana Pass
2019 年 10 月 24 日
Katie
2019 年 10 月 24 日
In your Y vector, your step size is 0 so it's an empty vector. Are you trying to pre-allocate the memory for the Y matrix that is generated by the meshgrid function? If so, you can use the following:
Y=zeros(length(gridspacing),length(gridspacing));
However, this will not change the plotted result. If you could provide some more info about what you're expecting to see, that would be great!
Briana Pass
2019 年 10 月 24 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

