计算脉冲在非线性耦合器中演化的Matlab 程序 b{lkl?@a ]}jY]
l % This Matlab script file solves the coupled nonlinear Schrodinger equations of
Qrt> vOUE7 % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
f*ZIBTb 9 % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
<@:LONe< % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
I)F3sS45} ;PhX[y^* %fid=fopen('e21.dat','w');
`xd{0EvF N = 128; % Number of Fourier modes (Time domain sampling points)
JheF}/Bx M1 =3000; % Total number of space steps
H He~OxWg J =100; % Steps between output of space
)6Qk|gIu( T =10; % length of time windows:T*T0
6"U)d7^ T0=0.1; % input pulse width
$5a%hK MN1=0; % initial value for the space output location
X8=sk dt = T/N; % time step
^DS+O> n = [-N/2:1:N/2-1]'; % Index
@~`2Lo/ t = n.*dt;
gDjs:]/YR u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
|{H-PH*Iz u20=u10.*0.0; % input to waveguide 2
m8njP-CZ u1=u10; u2=u20;
7nL3+Pq U1 = u1;
J2adA9R/, U2 = u2; % Compute initial condition; save it in U
5x; y{qT ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
YPqp#X* w=2*pi*n./T;
*,d>(\&[f g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
VC@{cVT L=4; % length of evoluation to compare with S. Trillo's paper
{9C+=v? dz=L/M1; % space step, make sure nonlinear<0.05
['rqz1DL5 for m1 = 1:1:M1 % Start space evolution
=e$6o 2!'} u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
fd Rw:K8 u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
F,-S&d ca1 = fftshift(fft(u1)); % Take Fourier transform
ghd*EXrF
H ca2 = fftshift(fft(u2));
&r
Lg/UEV- c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
*eo<5YUHt c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
B!cg)Y?.bd u2 = ifft(fftshift(c2)); % Return to physical space
uM<6][^` u1 = ifft(fftshift(c1));
QcDWVM'v if rem(m1,J) == 0 % Save output every J steps.
aPMqJ#fIr U1 = [U1 u1]; % put solutions in U array
ZNvnVW< U2=[U2 u2];
0cm+: MN1=[MN1 m1];
p x1{=~V/ z1=dz*MN1'; % output location
-5 YvtL end
T7{Z0- end
9(( QSX hg=abs(U1').*abs(U1'); % for data write to excel
#}rv) ha=[z1 hg]; % for data write to excel
GKNH{|B$D t1=[0 t'];
|Skk1# hh=[t1' ha']; % for data write to excel file
a}+7MEUmZ/ %dlmwrite('aa',hh,'\t'); % save data in the excel format
R1DXi figure(1)
Xbb('MoI63 waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
PDnwaK figure(2)
}#/,nJm' waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
1MCHwX3/ !`G7X 非线性超快脉冲耦合的数值方法的Matlab程序 'e4 ;,m \e/'d~F 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
IP` ;hC Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
+ fQ=G/ 5Q.bwl : 4#z@B1Jx :>.~"uWo{ % This Matlab script file solves the nonlinear Schrodinger equations
/f9jLY+ % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
^< ,Np+ % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
I4Ys,n % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
z Lw=* +FWkhmTv C=1;
f-?00*T M1=120, % integer for amplitude
=yfLqU M3=5000; % integer for length of coupler
b0CtQe N = 512; % Number of Fourier modes (Time domain sampling points)
UpgY}pf} dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
wyk4v} T =40; % length of time:T*T0.
#KonVM(` dt = T/N; % time step
DdTTWp/ n = [-N/2:1:N/2-1]'; % Index
hN6j5.x% t = n.*dt;
{@u;F2? ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
xFpMn}CD w=2*pi*n./T;
n:GK0wu.s
g1=-i*ww./2;
9IKFrCO9, g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
)jK"\'cK g3=-i*ww./2;
{ZH9W P1=0;
)POuH*j P2=0;
Ch`XwLY9 P3=1;
)~<8j P=0;
qJj;3{X2 for m1=1:M1
8VJUaL@ p=0.032*m1; %input amplitude
v?)-KtX| s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
DYU+?[J s1=s10;
;%Jw9G\h s20=0.*s10; %input in waveguide 2
4}{HRs? s30=0.*s10; %input in waveguide 3
Memz>uux s2=s20;
&UUIiQm~ s3=s30;
[ds:LQq)/ p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
FrO)3 1z %energy in waveguide 1
<JKRdIx&1 p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
-y{o@ %energy in waveguide 2
gRuNC=sR p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
*r)/.rK_ %energy in waveguide 3
aD,sx#g0 for m3 = 1:1:M3 % Start space evolution
Us'm9 J s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
Vh:%e24Z s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
xT I&X9P s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
]&1Kz
2/ sca1 = fftshift(fft(s1)); % Take Fourier transform
mu2r#I sca2 = fftshift(fft(s2));
}u&.n
pc sca3 = fftshift(fft(s3));
"_JGe#= sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
*M5=PQfb sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
F
kp;G sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
;}{%|UAsx s3 = ifft(fftshift(sc3));
|eIN<RY5 s2 = ifft(fftshift(sc2)); % Return to physical space
(b Q1,y s1 = ifft(fftshift(sc1));
%^m6Q! end
p6]4YGw*^ p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
<k'=_mC_ p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
cA1"Nek p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
6~sb8pK.= P1=[P1 p1/p10];
*
c]
:,5 P2=[P2 p2/p10];
etj8M
y6= P3=[P3 p3/p10];
!Ac <A. P=[P p*p];
>&tPIrz end
jQzq(oDQw figure(1)
S1{UVkr plot(P,P1, P,P2, P,P3);
!@!,7te '$W@I 转自:
http://blog.163.com/opto_wang/