plot spheres in 3D with one color (no gradient)
이전 댓글 표시
Hi everyone
I want to plot spheres in 3 D with one color (no gradient). I used surf function as shown below, where a is radius, XT,YT,ZT are the center position in x,y,z and N is number of spheres.
for k=1:1:1%size(XT,1)
for j=1:N
% Generate a sphere consisting of 20by 20 faces
[x,y,z]=sphere;
% use surf function to plot
hSurface=surf(a*x+XT(k,j),a*y+YT(k,j),a*z+ZT(k,j)); hold on
set(hSurface,'FaceColor',[0 0 1], 'FaceAlpha',0.5,'EdgeAlpha', 0);
axis([-0.5 0.5 -0.5 0.5 -0.5 0.5]);
daspect([1 1 1]);
W(k)=getframe(gcf);
end
hold off
xlabel('X')
ylabel('Y')
zlabel('Z')
end
movie2avi(W,'35_percent.avi');
Without using 'EdgeAlpha', the spheres look right in 3D but it is visible the point to point edges due to surf function. However, if I include 'EdgeAlpha' to make invisible point to point edges, but the spheres are now in Circle (2D).
How do I plot spheres in 3D and in one color without seeing the point-point edges of plotted surface.
Thanks
채택된 답변
추가 답변 (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!

