matlab中diff偏导函数,matlab中diff(偏导)使用错误

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);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值