Mathematica中文论坛-非官方

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 9520|回复: 0

matlab 豆粑粑 plot 3D ring

[复制链接]

529

主题

598

帖子

3010

积分

论坛元老

Rank: 8Rank: 8

积分
3010
发表于 2018-3-20 21:21:00 | 显示全部楼层 |阅读模式
本帖最后由 meatball1982 于 2018-3-22 10:08 编辑

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


透明的。
  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');
复制代码


fig_cir.png

fig_cir_green.png




tubeplot.zip

3.4 KB, 下载次数: 0

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|Mathematica中文论坛-非官方 ( 辽ICP备16001491号-1

GMT+8, 2024-4-19 10:10 , Processed in 0.159350 second(s), 29 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表