clc,clear all
lambda=6000:0.3:7500; % nm
c=3e17; % the speed of light (nm/s)
Q_o1=65;
Q_o2=65;
Q_e1=23;
Q_e2=38;
%--------------------------------------------------------------------------------------------------------------------------------------------------------------------
fai_1=pi; % the phase difference between two ring cavities comes from the dispersion equation of the SPPs wave in the static state;
%--------------------------------------------------------------------------------------------------------------------------------------------------------------------
lambda_2=6450; % nm
lambda_1=6800;
omiga=2*pi*c./lambda;
omiga_1=2*pi*c/lambda_1; % the frequency of the cavity 1
omiga_2=2*pi*c/lambda_2; % the frequency of the cavity 2
k_o1=omiga_1/(2*Q_o1); % the decay rate of the field due to the internal loss in the cavity 1
k_o2=omiga_2/(2*Q_o2); % the decay rate of the field due to the internal loss in the cavity 2
k_e1=omiga_1/(2*Q_e1); % the decay rate due to the energy of the cavity 1 escape into the waveguide
k_e2=omiga_2/(2*Q_e2); % the decay rate due to the energy of the cavity 2 escape into the waveguide
t_1=(j*(omiga_1-omiga)+k_o1)./(j*(omiga_1-omiga)+k_o1+k_e1); % the transmission coefficients of the cavity 1
t_2=(j*(omiga_2-omiga)+k_o2)./(j*(omiga_2-omiga)+k_o2+k_e2); % the transmission coefficients of the cavity 2
r_1=-k_e1./(j*(omiga_1-omiga)+k_o1+k_e1); % the reflection coefficients of the cavity 1
r_2=-k_e2./(j*(omiga_2-omiga)+k_o2+k_e2); % the reflection coefficients of the cavity 2
fai_2=-1*pi; % the optical Kerr effect modulation;
fai=fai_1+fai_2; % the total phase shift;
t=(t_1.*t_2)./(1-r_1.*r_2.*exp(j*2*fai));
%T=(abs(t)).^2;
%plot(lambda,T,'lineStyle','-','color','b','linewidth',3);
phaseshift=angle(t);
Ls=600;
Ng1=diff(phaseshift,omiga);
Ng=c/Ls*Ng1;
plot(lambda,Ng,'LineWidth',2)
%xlim([6000 7500]);
%ylim([-1 1]);
%set(gca,'XTick',6000:500:7500);%将当前图形,X坐标刻度,标志位0到220
%set(gca,'YTick',-1:0.5:1);%将当前图形,Y坐标刻度,标志位0到150
%set(gca, 'LineWidth',2);
xlabel('Wavelength(nm)');
ylabel('Phase shift');
%set(gca,'LineWidth',2,'FontName','Times New Roman','FontSize',30);