计算脉冲在非线性耦合器中演化的Matlab 程序 |7/B20 Q[p0bD: % This Matlab script file solves the coupled nonlinear Schrodinger equations of
UUY-EC7X % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
*<U&DOYV: % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
asW1GZO % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
2ezuP F z>i D %fid=fopen('e21.dat','w');
ooIMN = N = 128; % Number of Fourier modes (Time domain sampling points)
.KT+,Y M1 =3000; % Total number of space steps
A0rdQmrOL J =100; % Steps between output of space
NI(`o8fN T =10; % length of time windows:T*T0
J6 [x(T T0=0.1; % input pulse width
4_N)1u ! MN1=0; % initial value for the space output location
H]=3^ g64 dt = T/N; % time step
z[v5hhI)4 n = [-N/2:1:N/2-1]'; % Index
_T5~B"* t = n.*dt;
9zO3KT2 u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
,mYoxEB kl u20=u10.*0.0; % input to waveguide 2
vo`wYJ3W u1=u10; u2=u20;
].dTEzL9X U1 = u1;
@?Y^=0 U2 = u2; % Compute initial condition; save it in U
o Ayk ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
{u.V8%8 w=2*pi*n./T;
-t6d`p;dR g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
0dkM72p L=4; % length of evoluation to compare with S. Trillo's paper
X=\#n-* dz=L/M1; % space step, make sure nonlinear<0.05
4!k={Pd for m1 = 1:1:M1 % Start space evolution
t48(GKF u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
$xu?zd" u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
#]eXI
$HP ca1 = fftshift(fft(u1)); % Take Fourier transform
+zs6$OI]V ca2 = fftshift(fft(u2));
`FJnR~d
c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
Xq>e]#gR c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
iY|YEi8 u2 = ifft(fftshift(c2)); % Return to physical space
\;7DS:d@ u1 = ifft(fftshift(c1));
b7AuKY{L if rem(m1,J) == 0 % Save output every J steps.
U*&ZQw U1 = [U1 u1]; % put solutions in U array
0"2 [I U2=[U2 u2];
X^|oY]D MN1=[MN1 m1];
o@>c[knJ z1=dz*MN1'; % output location
WQ5sC[& end
Ab2g),;c end
(v4 hg=abs(U1').*abs(U1'); % for data write to excel
H;sQ]:.*] ha=[z1 hg]; % for data write to excel
Ve8! t1=[0 t'];
k@8#By l| hh=[t1' ha']; % for data write to excel file
3yKI2en" %dlmwrite('aa',hh,'\t'); % save data in the excel format
9uS7G * figure(1)
Ox~'w0c,f waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
~o/^=:* figure(2)
#>v7"
< waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
'hekCZZ_I #Y5I_:k 非线性超快脉冲耦合的数值方法的Matlab程序 tt^ze|*&t m@O\Bi}=} 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
g?>AY2f[5 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
bg
HaheU @Qs-A^. z'qVEHc) kQ#eWk J, % This Matlab script file solves the nonlinear Schrodinger equations
__ mtZ{ % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
sRZ:9de+ % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
N6J$z\
P % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
4]B3C\
v
5pok%g
C=1;
Vd?v"2S(9 M1=120, % integer for amplitude
/B!m|)h5~ M3=5000; % integer for length of coupler
tH'VV-!MZ N = 512; % Number of Fourier modes (Time domain sampling points)
13QCM0# dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
2YN`:" T =40; % length of time:T*T0.
}=|ZEhtOp dt = T/N; % time step
Oq2H>eW`f n = [-N/2:1:N/2-1]'; % Index
Qi[D&47XO t = n.*dt;
bY2Mw8e% ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
!n{c#HfG w=2*pi*n./T;
gPwp
[ g1=-i*ww./2;
vLS9V/o g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
d_,tXV"z& g3=-i*ww./2;
5i^vN"J P1=0;
%f-<ol P2=0;
O5{XT]: P3=1;
2:N_c\Vi P=0;
qE{cCS for m1=1:M1
.]e6TFsrO p=0.032*m1; %input amplitude
w3w*"M s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
vf yva s1=s10;
A pjqSz" s20=0.*s10; %input in waveguide 2
0l6iv[qu5w s30=0.*s10; %input in waveguide 3
SNU
bY6 s2=s20;
cP2R24th s3=s30;
yy} 0_ p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
o3yqG#dA %energy in waveguide 1
`_'Dj> p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
d8kwW!m+ %energy in waveguide 2
]= NYvv>H p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
c_q+_$t %energy in waveguide 3
be/1-=m for m3 = 1:1:M3 % Start space evolution
7q:bBS s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
N1!5J(V4 s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
>>bYg s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
5dp#\J@ sca1 = fftshift(fft(s1)); % Take Fourier transform
5)zB/Ta< sca2 = fftshift(fft(s2));
,&?q}M sca3 = fftshift(fft(s3));
W`'|&7~ sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
iy82QNe sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
mG~y8nUtp sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
XC1lo4| s3 = ifft(fftshift(sc3));
.:ZXtU s2 = ifft(fftshift(sc2)); % Return to physical space
iFCH$! s1 = ifft(fftshift(sc1));
&&]!+fTZ\( end
|2<f<k/UT p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
V3W85_* p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
G
r|@CZq p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
-NPkN%h P1=[P1 p1/p10];
c2\vG P2=[P2 p2/p10];
Cj1UD; P3=[P3 p3/p10];
C5 5n P=[P p*p];
DiQkT R end
e-cb?.WU? figure(1)
pInWKj[y1 plot(P,P1, P,P2, P,P3);
_*$B|%k .r| vz6tU? 转自:
http://blog.163.com/opto_wang/