matlab画图问题。
Show older comments
这个是把半径为1、0.75、0.5的球离散化为20X20的网格点,并绘制散点图,请问这两个ones命令组成的向量是什么意思呢?

N=20;
[X,Y,Z]=sphere(N-1)
x=X(:); y=Y(:); z=Z(:)
x=[x;x*0.75;x*0.5]; y=[y;y*0.75;y*0.5]; z=[z;z*0.75;z*0.5];
s=[ones(N.^2,1)*40;ones(N.^2,1)*30;ones(N.^2,1)*20];
c=[ones(N.^2,1)*3;ones(N.^2,1)*2;ones(N.^2,1)];
scatter3(x,y,z,s,c,'filled')
xlabel('x');ylabel('y');zlabel('z')
colorbar
Accepted Answer
More Answers (0)
Categories
Find more on 插值 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!