计算脉冲在非线性耦合器中演化的Matlab 程序 :S'P
lH 8gWifx
#N % This Matlab script file solves the coupled nonlinear Schrodinger equations of
@T[}]e % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
xU+c?OLi % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
4%>iIPXi.( % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
v
MTWtc!6 INqD(EG %fid=fopen('e21.dat','w');
Wm\HZ9PN N = 128; % Number of Fourier modes (Time domain sampling points)
1uBnU2E M1 =3000; % Total number of space steps
$\?BAkx J =100; % Steps between output of space
}@%A@A{R T =10; % length of time windows:T*T0
sc
dU T0=0.1; % input pulse width
?CIMez(h MN1=0; % initial value for the space output location
h}r64<Y2{ dt = T/N; % time step
ovJwor n = [-N/2:1:N/2-1]'; % Index
0V6gNEAUg t = n.*dt;
]FV,}EZ u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
Xr'Y[E[ u20=u10.*0.0; % input to waveguide 2
.vHSKd{ u1=u10; u2=u20;
V("@z<b| U1 = u1;
:MPWf4K2s U2 = u2; % Compute initial condition; save it in U
[)UL}vAO\q ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
A3D"b9<D w=2*pi*n./T;
X:Z4QqT g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
%_Gc9SI L=4; % length of evoluation to compare with S. Trillo's paper
7`-f N| dz=L/M1; % space step, make sure nonlinear<0.05
d Bn/_ for m1 = 1:1:M1 % Start space evolution
'jh9n7mH u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
W&>ONo6ki u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
JwEQR ca1 = fftshift(fft(u1)); % Take Fourier transform
vt)u`/u ca2 = fftshift(fft(u2));
j_L1KB* c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
0\XG;KA c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
bV c"'RQ u2 = ifft(fftshift(c2)); % Return to physical space
_0^f u1 = ifft(fftshift(c1));
eT8(O36% if rem(m1,J) == 0 % Save output every J steps.
~nO]R U1 = [U1 u1]; % put solutions in U array
j6x1JM U2=[U2 u2];
#nG?}*# MN1=[MN1 m1];
P X/{ z1=dz*MN1'; % output location
K[}5bjh> end
AA$+ayzx9{ end
~2 aR>R_nT hg=abs(U1').*abs(U1'); % for data write to excel
e(nT2E ha=[z1 hg]; % for data write to excel
^APPWQUl t1=[0 t'];
w0W9N%f#= hh=[t1' ha']; % for data write to excel file
\/=w\Tj %dlmwrite('aa',hh,'\t'); % save data in the excel format
D|m]]B figure(1)
fsd,q?{a: waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
'Pk14`/ figure(2)
5X"y46i,H waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
G&ZpQ) AcC'hr.N+ 非线性超快脉冲耦合的数值方法的Matlab程序 }EFMJ,NQ q6E8^7RtS@ 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
*\W
*,D.I 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
Z*r;"WHB tR`'( *wh w]2tb $'m&RzZ % This Matlab script file solves the nonlinear Schrodinger equations
eYSVAj % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
d3%1P) % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
J*4byu| % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
::'DWD1 #$/SM_X14C C=1;
/m#!<t7 M1=120, % integer for amplitude
@log=^ M3=5000; % integer for length of coupler
#fT1\1[] N = 512; % Number of Fourier modes (Time domain sampling points)
8&d s dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
BEU^,r3z T =40; % length of time:T*T0.
Y<1]{4Wt dt = T/N; % time step
rID_^g_tP8 n = [-N/2:1:N/2-1]'; % Index
V*
:Q~
^ t = n.*dt;
WsHC%+\' ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
ur*a!U w=2*pi*n./T;
wO\,?SI4 g1=-i*ww./2;
G3 h&nH,> g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
e[5=?p@| g3=-i*ww./2;
;4E(n P1=0;
<<Zt.!hS P2=0;
$inpiO|s P3=1;
>LqW;/&S< P=0;
">$.>sn{ for m1=1:M1
M{sn{ p=0.032*m1; %input amplitude
L
p(6K s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
s]=bg+v?j s1=s10;
RDFOUqS s20=0.*s10; %input in waveguide 2
3WH"NC-O< s30=0.*s10; %input in waveguide 3
Z{'.fq2A s2=s20;
1w30Vj2< s3=s30;
<W$Ig@4[.d p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
KDt@Xi6|| %energy in waveguide 1
t,CC~ p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
D4';QCwo %energy in waveguide 2
.W[[Z;D p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
nMz~.^Q- %energy in waveguide 3
Kr;7~`$[ for m3 = 1:1:M3 % Start space evolution
>9?BJv2 s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
m\h. sg& s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
:Fvd?[ s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
4tZnYGvqe sca1 = fftshift(fft(s1)); % Take Fourier transform
lQt&K1m sca2 = fftshift(fft(s2));
|.8lS3C sca3 = fftshift(fft(s3));
fe,A\W&8 sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
Y(:.f-Du sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
O-5s}RT sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
-Odk'{nW s3 = ifft(fftshift(sc3));
\I3={ii0 s2 = ifft(fftshift(sc2)); % Return to physical space
7mUpn:U s1 = ifft(fftshift(sc1));
;t^8lC?>V end
.1O
p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
vocXk_ p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
>icL,n"] p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
a.oZ}R7'Y P1=[P1 p1/p10];
QH?}uX'x)G P2=[P2 p2/p10];
$}9.4`F> P3=[P3 p3/p10];
wK0= I\WN9 P=[P p*p];
KINKq`Sx end
3n\eCdV-b< figure(1)
b[mAkm?9+1 plot(P,P1, P,P2, P,P3);
g{]C@,W %`o3YR 转自:
http://blog.163.com/opto_wang/