0

我是新来的,对matlab有一点经验。

在这里,我有一个等高线图,等高线之间的每个区域在颜色条上用不同的颜色描绘。我想知道如何防止这种着色,而是让它只有一种颜色。

还有一件事,我想知道如果我想添加一个条件,或者换句话说,一个黑色(因为我的颜色条中没有黑色),比如如果 deltabeta=-2 gamma P 使 deltabeta 黑色是可能的

在此处输入图像描述

%gamma=20;
gamma=580;
%P=0.1;
P=0.75;
N=P.*gamma;
lamdazero=1550;
[lamdapump,lamdasignal] = meshgrid(1550:0.1:1700,1550:0.1:1700);
beta3=1.3;
beta4=-8*10^-4;
%beta3=0.06;
%beta4=-2*10^-4;
c=2*pi*3*10^8;
%L=1;
L=0.01;
A0=(1./lamdapump) -(1./lamdazero);
B0=(1./lamdapump) -(1./lamdasignal);
%Linearmismatch=beta2.*c.^2.*(B0).^2;
%beta2=(6*pi.*10^5.*beta3.*A0) +(0.5.*beta4.*A0.^2).*(6.*pi.*10^5)^2;
%Second0=(1./2).*beta2.*(c.^2).*(B0.^2);
Third0=10^-9.*beta3.*(c.^3).*A0.*(B0.^2);
Fourth0=10^-12.*beta4.*(1./2).*c.^4.*(A0.^2).*(B0.^2);
%S4=(10^-12/12).*beta4.*c.^4*(B0.^4);
Fourorder=(10^-12).*c.^4.*beta4.*(1/12).*(B0).^4;
g0=1.1*10^-11;
Aeff=11*10^-12;
PSBS=0.025;
%g0=3.9*10^-9;
%Aeff=14*10^-12;
%PSBS=0.005;
SBS=(g0.*PSBS.*1000)./Aeff ;
deltabeta=Third0+Fourth0+Fourorder;
hold on
 for i=1:1:length(deltabeta)
    for j=1:1:length(deltabeta)
       if(deltabeta(i,j)>=0 || deltabeta(i,j)<=(-4*N))
         test(i,j)=NaN;
       else
          test(i,j)=deltabeta(i,j);
        end
    end
 end
contourf(lamdapump,lamdasignal,test,'ShowText','off');
cmap=[0,0,0];
colormap=cmap;
colorbar
 h = colorbar;
 set(get(h,'title'),'string','\Delta \beta (\gamma P)');
ax = findobj('type','axes');
%set(ax(1),'ytickl',{'-5172.4', '-4310.3', '-3448.3', '-2586.2', '-1724.1',' -862.1', '0', '862.1', '1724.1'})
 xlabel('\lambda_p_u_m_p')
ylabel('\lambda_s_i_g_n_a_l')
title('Contour representing linear phase mismatch for FWM pump power 75 mW and SBS pump power 25 mW ')
4

1 回答 1

0

指定一种颜色

您可以通过caxis([0, 10]);在声明h = colorbar;. 例如,在这里,我在不移除轮廓的情况下让所有东西看起来都是深蓝色。在我的示例中,0 是最小颜色值,10 是最大值 - 您可以更改这些以匹配您喜欢的颜色。

删除彩条

您还可以使用删除右侧的颜色栏delete(h)

在此处输入图像描述

代码

%gamma=20;
gamma=580;
%P=0.1;
P=0.75;
N=P.*gamma;
lamdazero=1550;
[lamdapump,lamdasignal] = meshgrid(1550:0.1:1700,1550:0.1:1700);
beta3=1.3;
beta4=-8*10^-4;
%beta3=0.06;
%beta4=-2*10^-4;
c=2*pi*3*10^8;
%L=1;
L=0.01;
A0=(1./lamdapump) -(1./lamdazero);
B0=(1./lamdapump) -(1./lamdasignal);
%Linearmismatch=beta2.*c.^2.*(B0).^2;
%beta2=(6*pi.*10^5.*beta3.*A0) +(0.5.*beta4.*A0.^2).*(6.*pi.*10^5)^2;
%Second0=(1./2).*beta2.*(c.^2).*(B0.^2);
Third0=10^-9.*beta3.*(c.^3).*A0.*(B0.^2);
Fourth0=10^-12.*beta4.*(1./2).*c.^4.*(A0.^2).*(B0.^2);
%S4=(10^-12/12).*beta4.*c.^4*(B0.^4);
Fourorder=(10^-12).*c.^4.*beta4.*(1/12).*(B0).^4;
g0=1.1*10^-11;
Aeff=11*10^-12;
PSBS=0.025;
%g0=3.9*10^-9;
%Aeff=14*10^-12;
%PSBS=0.005;
SBS=(g0.*PSBS.*1000)./Aeff ;
deltabeta=Third0+Fourth0+Fourorder;
hold all
 for i=1:1:length(deltabeta)
    for j=1:1:length(deltabeta)
       if(deltabeta(i,j)>=0 || deltabeta(i,j)<=(-4*N))
         test(i,j)=NaN;
       else
          test(i,j)=deltabeta(i,j);
        end
    end
 end
contourf(lamdapump,lamdasignal,test,'ShowText','off');
cmap=[0,0,0];
colormap=cmap;
caxis([0, 10]);  % decide the color of your contour plot here
h = colorbar;
pause(1);
set(get(h,'title'),'string','\Delta \beta (\gamma P)');
ax = findobj('type','axes');
%set(ax(1),'ytickl',{'-5172.4', '-4310.3', '-3448.3', '-2586.2', '-1724.1',' -862.1', '0', '862.1', '1724.1'})
 xlabel('\lambda_p_u_m_p')
ylabel('\lambda_s_i_g_n_a_l')
title('Contour representing linear phase mismatch for FWM pump power 75 mW and SBS pump power 25 mW ')
delete(h);
于 2015-02-13T09:51:35.403 回答