plotting sphere and rectangle mesh

22 次查看(过去 30 天)
need help on plotting something like this :
any idea ?

采纳的回答

Azzi Abdelmalek
Azzi Abdelmalek 2015-6-23
编辑:Azzi Abdelmalek 2015-6-23
sphere(20)
axis square
You can get the coordinates x,y and z
[x,y,z]=sphere(20)
You can plot a sphere
surf(x,y,z)
  4 个评论
Azzi Abdelmalek
Azzi Abdelmalek 2015-6-23
编辑:Azzi Abdelmalek 2015-6-23
ii=-1:0.1:1
jj=-1:0.1:1
[ii1,jj1]=meshgrid(ii,jj)
surf(ii,jj,zeros(size(ii1)))
hold on
sphere(20)
cob
cob 2015-6-23
编辑:cob 2015-6-23
Thanks a lot , i did a little modification base on your code : x = -2:0.1:2;
y = -2:0.1:2;
[X,Y] = meshgrid(x,y);
surf(x,y,zeros(size(X)),'Facecolor','black');
hold on
sphere(25);
axis square
legend('the square',' the ball of 20','Location','SouthWest');

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by