Mathematica中文论坛-非官方
标题:
豆粑粑 matlab 在圆形的区域内contourf,再挖掉一部分
[打印本页]
作者:
meatball1982
时间:
2017-5-25 09:50
标题:
豆粑粑 matlab 在圆形的区域内contourf,再挖掉一部分
别人的问题,在一个圆里面画contourf的图,再挖去一块。
http://www.ilovematlab.cn/forum. ... p;extra=#pid3221245
fig_cont_2D.png
(247.85 KB, 下载次数: 1334)
下载附件
2017-5-25 09:49 上传
clear all
clc
clf
[x,y,z]=peaks(40);
r_big=linspace(0,3,400);
the=linspace(0,2*pi,720);
the=[2*pi,the];
[R_big,The]=meshgrid(r_big,the);
X_cir_big=R_big.*cos(The);
Y_cir_big=R_big.*sin(The);
Z_cir_big=griddata(x(:),y(:),z(:),X_cir_big,Y_cir_big);
Cir_big_x =r_big(end)*cos(the);
Cir_big_y =r_big(end)*sin(the);
r_sma=0.9;
cen_x=-1.7;
cen_y=0.3;
Cir_sma_x =r_sma*cos(the)+cen_x;
Cir_sma_y =r_sma*sin(the)+cen_y;
ind=((X_cir_big-cen_x).^2+(Y_cir_big-cen_y).^2)<r_sma^2;
% X_cir_big(ind)=nan;
% Y_cir_big(ind)=nan;
Z_cir_big(ind)=nan;
hold on
% surf(X_cir_big,Y_cir_big,Z_cir_big,'edgecolor','none');
[C,h]=contourf(X_cir_big,Y_cir_big,Z_cir_big,20,'linecolor','k','linestyle','--');
clabel(C,'fontSize',8)
colorbar
plot(Cir_big_x,Cir_big_y,'k','linewidth',1)
plot(Cir_sma_x,Cir_sma_y,'k','linewidth',1)
axis equal
axis off
colormap(jet)
h=gcf;
fi_na=['./fig_cont_2D'];
fun_work_li_035_myfig_out(h,fi_na,3);
复制代码
欢迎光临 Mathematica中文论坛-非官方 (http://ilovemathematica.com/)
Powered by Discuz! X3.2