meatball1982 发表于 2018-3-20 21:21:00

matlab 豆粑粑 plot 3D ring

本帖最后由 meatball1982 于 2018-3-22 10:08 编辑

别人的问题,
http://www.ilovematlab.cn/thread-538722-1-1.html
如何画一个ring.


透明的。
clear all
clc
clf


u=linspace(0,2*pi,500);

v=linspace(0,2*pi,500);

=meshgrid(u,v);

x=(2+cos(uu)).*cos(vv);

y=(2+cos(uu)).*sin(vv);

z=sin(uu);

h=surf(x,y,z,1.5*ones(size(x)),'edgecolor','none');
alpha(h,0.8)
shading interp
camlight
axis equal
colormap(jet)
box off
axis off
view(40,25)

h=gcf;
fig_na = ['./fig_cir_green'];
fun_work_li_035_myfig_out(h,fig_na,3);


update: tubeplot 2 plot a tube with different color.

clear all
clc
clf


u=linspace(0,2*pi,100);

v=linspace(0,2*pi,100);

=meshgrid(u,v);

x=(2+cos(uu)).*cos(vv);

y=(2+cos(uu)).*sin(vv);

z=sin(uu);

hold on
h=surf(x,y,z,cos(x/2).*sin(y),'edgecolor','none');

colormap(jet)


t=0:(2*pi/1000):(2*pi);
x=cos(t*2).*(3+sin(t*3)*.3);
y=sin(t*2).*(4+sin(t*3)*.3);
z=cos(t*3)*.3;

tubeplot(x,y,z,0.05*ones(size(t)),0.3*sin(t),40)
axis equal
alpha(h,0.6)
shading interp
camlight
axis equal
colormap(jet)
box off
axis off
view(40,25)



tubeplot要修改一下其中的surf
      surf(X,Y,Z,V,'edgecolor','none');








页: [1]
查看完整版本: matlab 豆粑粑 plot 3D ring