![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/174988/image.jpeg)
Code for Plotting Sphere function
7 ビュー (過去 30 日間)
古いコメントを表示
Can anybody share the complete code for plotting sphere function
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156146/image.png)
like this
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156148/image.png)
in matlab
0 件のコメント
採用された回答
John BG
2016 年 9 月 5 日
Atinesh, 4 steps
1. define the [x y] grid:
x=[-10:1:10];y=[-10:1:10];
2. build all possible points, there are other ways but this is the most compact one
[X,Y]=meshgrid(x,y);
3. Calculate the function points
Z=X.^2+Y.^2;
4. 3D plot with surf
surf(Z)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/174988/image.jpeg)
Atesh,
if you find this answer useful would you please be so kind to mark my answer as Accepted Answer?
To any other reader, please if you find this answer of any help solving your question,
please click on the thumbs-up vote link,
thanks in advance
John BG
その他の回答 (0 件)
参考
カテゴリ
Help Center および 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!