下午好,我有这段代码,我想在其中指定三个彩色区域。一种是当最终函数 C 和 C1 如代码所示合并在一起时小于 0 、介于 0 和 1 之间以及大于 1 时。在代码中,我需要最后合并和定义合并的轮廓图在三个简单的区域。结果如下图所示。一开始您可能会认为最主要的颜色是亮蓝色,但是当您查看轮廓图和颜色条时,由于某种原因它们不匹配。谢谢您的帮助。向管理员道歉,因为没有将此问题作为单独的问题发布。
[r,R] = meshgrid(0.1:0.01:10,-5:0.01:5);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Z=(((R).^2)-1 );
A=2+ (R.*(r+(1./r)));
B=sqrt(Z).*(r-(1./r));
Ratio=acoth(A./B);
D= (r+(1./r))./4;
E=D./sqrt(Z);
C=D.*E.*Ratio;
C(R==1)=(r(R==1)+(1./r(R==1)))*0.25.*((r(R==1).^2-1)./(2*r(R==1)+r(R==1).^2-1) );
C(R==-1)=(r(R==-1)+(1./r(R==-1)))*0.25.*((r(R==1).^2-1)./(2*r(R==1)-r(R==1).^2+1) );
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Z1=((1 -(R).^2));
A1=2+ (R.*(r+(1./r)));
B1=sqrt(Z1).*(r-(1./r));
Ratio1=EA(A1./B1);
D1= (r+(1./r))./4;
E1=D1./sqrt(Z1);
C1=D1.*E1.*Ratio1;
C1(R==1)=(r(R==1)+(1./r(R==1)))*0.25.*((r(R==1).^2-1)./(2*r(R==1)+r(R==1).^2-1) );
C1(R==-1)=(r(R==-1)+(1./r(R==-1)))*0.25.*((r(R==1).^2-1)./(2*r(R==1)-r(R==1).^2+1) );
test=C;
test((R<1)&(R>-1))=nan;
test1=C1;
test1(R>1)=nan;
test2=test1;
test2(R<-1)=nan;
figure
contourf(r,R,test)
hold on
contourf(r,R,test2);
colormap(jet(3))
conts = [-1:1:2];
h=colorbar;
set(get(h,'ylabel'),'string','\gamma P_P L','FontSize',18)
xlabel('$r$','Interpreter','latex','FontSize',18)
ylabel('$D \over 2\sqrt{M}$','Interpreter','latex','FontSize',18)
set(h,'YTick',conts)
set(gca,'fontsize',18)
hold off
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function y = EA(x)
y = acot(x);
y(y<0)=y(y<0)+pi;
return
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%