Mathematica中文论坛-非官方

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 7647|回复: 0
打印 上一主题 下一主题

豆粑粑 matlab 在圆形的区域内contourf,再挖掉一部分

[复制链接]

532

主题

603

帖子

3035

积分

论坛元老

Rank: 8Rank: 8

积分
3035
跳转到指定楼层
楼主
发表于 2017-5-25 09:50:03 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

别人的问题,在一个圆里面画contourf的图,再挖去一块。

http://www.ilovematlab.cn/forum. ... p;extra=#pid3221245


  1. clear all
  2. clc
  3. clf

  4. [x,y,z]=peaks(40);
  5. r_big=linspace(0,3,400);
  6. the=linspace(0,2*pi,720);
  7. the=[2*pi,the];

  8. [R_big,The]=meshgrid(r_big,the);
  9. X_cir_big=R_big.*cos(The);
  10. Y_cir_big=R_big.*sin(The);

  11. Z_cir_big=griddata(x(:),y(:),z(:),X_cir_big,Y_cir_big);

  12. Cir_big_x =r_big(end)*cos(the);
  13. Cir_big_y =r_big(end)*sin(the);


  14. r_sma=0.9;
  15. cen_x=-1.7;
  16. cen_y=0.3;

  17. Cir_sma_x =r_sma*cos(the)+cen_x;
  18. Cir_sma_y =r_sma*sin(the)+cen_y;



  19. ind=((X_cir_big-cen_x).^2+(Y_cir_big-cen_y).^2)<r_sma^2;

  20. % X_cir_big(ind)=nan;
  21. % Y_cir_big(ind)=nan;
  22. Z_cir_big(ind)=nan;
  23. hold on
  24. % surf(X_cir_big,Y_cir_big,Z_cir_big,'edgecolor','none');
  25. [C,h]=contourf(X_cir_big,Y_cir_big,Z_cir_big,20,'linecolor','k','linestyle','--');
  26. clabel(C,'fontSize',8)
  27. colorbar
  28. plot(Cir_big_x,Cir_big_y,'k','linewidth',1)
  29. plot(Cir_sma_x,Cir_sma_y,'k','linewidth',1)
  30. axis equal
  31. axis off
  32. colormap(jet)
  33. h=gcf;
  34. fi_na=['./fig_cont_2D'];
  35. fun_work_li_035_myfig_out(h,fi_na,3);
复制代码




分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-4 09:31 , Processed in 0.123948 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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