matlab画图问题。
2 views (last 30 days)
Show older comments
果博东方开户客服【微8785092】
on 23 May 2023
Answered: 果博东方开户经理【微8785092】
on 23 May 2023
这个是把半径为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
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!