怎样用matlab画等值线图,取值范围为特殊形状?

2024-11-18 17:24:45
推荐回答(2个)
回答1:

>> x=-1:0.01:1;
>> y=-1:0.02:1;
>> [xx,yy]=meshgrid(x,y);
>> zz=xx.^2+yy.^2;
>> contour(xx,yy,zz,20)

>> figure
%left,right,top,bottom为去掉的部分
>> left=-0.4;
>> right=0.6;
>> top=-0.1;
>> bottom=-0.5;
>> zz(find((xx>left).*(xxbottom).*(yy>> contour(xx,yy,zz,20)

回答2:

把对应不要的区域换成nan