plot 3D and combine in matlab
i have this matrix "experiment=2*rand(npoints,3)-1"
.
I want to plot in in 3D,so i use "mesh(experiment)"
.
How can i开发者_开发问答 take red points in my plot?
Also,i want to implement in the above plot , a sphere with radius 1 at 0,0,0. I did :
mesh(experiment)
hold on
[x,y,z]=sphere;
r=1;
mesh(r*x,r*y,r*z)
hold off
but 1) i am not taking radius 1 2) the figures just showing in the same graph but don't combine
Thanks
Use scatter3
to plot points
scatter3(experiment(:,1), experiment(:,2), experiment(:,3), '.r');
See-thru mesh
mesh(r*x,r*y,r*z, 'FaceColor','none', 'EdgeColor','b')
Or semi-transparent mesh
mesh(r*x,r*y,r*z, 'FaceColor','w', 'EdgeColor','b')
alpha(0.5)
精彩评论