Mathematica中文论坛-非官方

标题: matlab 豆粑粑 plot 3D ring [打印本页]

作者: meatball1982    时间: 2018-3-20 21:21
标题: matlab 豆粑粑 plot 3D ring
本帖最后由 meatball1982 于 2018-3-22 10:08 编辑

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


透明的。
  1. clear all
  2. clc
  3. clf


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

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

  6. [uu vv]=meshgrid(u,v);

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

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

  9. z=sin(uu);

  10. h=surf(x,y,z,1.5*ones(size(x)),'edgecolor','none');
  11. alpha(h,0.8)
  12. shading interp
  13. camlight
  14. axis equal
  15. colormap(jet)
  16. box off
  17. axis off
  18. view(40,25)

  19. h=gcf;
  20. fig_na = ['./fig_cir_green'];
  21. fun_work_li_035_myfig_out(h,fig_na,3);
复制代码



update: tubeplot 2 plot a tube with different color.

  1. clear all
  2. clc
  3. clf


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

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

  6. [uu vv]=meshgrid(u,v);

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

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

  9. z=sin(uu);

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

  12. colormap(jet)


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

  17. tubeplot(x,y,z,0.05*ones(size(t)),0.3*sin(t),40)
  18. axis equal
  19. alpha(h,0.6)
  20. shading interp
  21. camlight
  22. axis equal
  23. colormap(jet)
  24. box off
  25. axis off
  26. view(40,25)
复制代码



tubeplot要修改一下其中的surf
  1.       surf(X,Y,Z,V,'edgecolor','none');
复制代码









tubeplot.zip

3.4 KB, 下载次数: 0






欢迎光临 Mathematica中文论坛-非官方 (http://ilovemathematica.com/) Powered by Discuz! X3.2