计算脉冲在非线性耦合器中演化的Matlab 程序 ^P&)2m:s '5V2{k$4U % This Matlab script file solves the coupled nonlinear Schrodinger equations of
FsrGI
(x? % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
@/6cEiC+r\ % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
&r\pQ}; % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
v1h*/#
ps:|YR %fid=fopen('e21.dat','w');
ht8%A 1| N = 128; % Number of Fourier modes (Time domain sampling points)
Ip}(!D| M1 =3000; % Total number of space steps
P$MAURFm J =100; % Steps between output of space
gie}k)&M T =10; % length of time windows:T*T0
Q`#Y_N-h+ T0=0.1; % input pulse width
LD]>_P83 MN1=0; % initial value for the space output location
cX$ Pq dt = T/N; % time step
o,a3J:j] n = [-N/2:1:N/2-1]'; % Index
D{~mJDUzK t = n.*dt;
p"Ki$.Y u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
g0@i[&A@{ u20=u10.*0.0; % input to waveguide 2
K-VNU u1=u10; u2=u20;
wpw~[xd U1 = u1;
}a= &o6= U2 = u2; % Compute initial condition; save it in U
mZ9+.lm ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
]m0MbA w=2*pi*n./T;
]<D9Q> g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
9)={p9FZY L=4; % length of evoluation to compare with S. Trillo's paper
't3/< h< dz=L/M1; % space step, make sure nonlinear<0.05
IZ /M d@C for m1 = 1:1:M1 % Start space evolution
$N[-ks2{@ u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
x|/zn<\^ u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
KL]@y!QU ca1 = fftshift(fft(u1)); % Take Fourier transform
lxTW1kr ca2 = fftshift(fft(u2));
|sWH!:]49 c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
Lx&2) c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
AtNu:U$ u2 = ifft(fftshift(c2)); % Return to physical space
<'H^}gQow u1 = ifft(fftshift(c1));
.%>UA|[~: if rem(m1,J) == 0 % Save output every J steps.
B42.;4"T U1 = [U1 u1]; % put solutions in U array
VIo %(( U2=[U2 u2];
3{o5AsVv MN1=[MN1 m1];
*RKYdwnb z1=dz*MN1'; % output location
OZdiM&Zss end
P@LYa_UFsN end
j*"V!d hg=abs(U1').*abs(U1'); % for data write to excel
wkm;yCF+ ha=[z1 hg]; % for data write to excel
Nq>74q]}n8 t1=[0 t'];
;2K_u hh=[t1' ha']; % for data write to excel file
;j]0GD,c$ %dlmwrite('aa',hh,'\t'); % save data in the excel format
:Mr _/t2( figure(1)
VZNMom,Wr waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
_uL{@( figure(2)
wPTXRq% waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
) &[S*g qYj
EQz 非线性超快脉冲耦合的数值方法的Matlab程序 ES72yh] 1MI/:vy- 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
H3T4v1o6 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
"#x<>a)O\ \4y7! 3 A2X1V" d*ch.((- % This Matlab script file solves the nonlinear Schrodinger equations
L2Ynv4llm % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
COJny/FT| % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
"\bbe @ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
}=Yvs) #N\kMJl$l C=1;
Afi;s., M1=120, % integer for amplitude
E/9h"zowS M3=5000; % integer for length of coupler
o9+"6V|. N = 512; % Number of Fourier modes (Time domain sampling points)
&VtTUy} dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
xwG=&+66 T =40; % length of time:T*T0.
]Ga }+^ dt = T/N; % time step
gZ6]\l]J{ n = [-N/2:1:N/2-1]'; % Index
5I9~OJ> t = n.*dt;
fMRBGcg7Dc ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
co<-gy/mCR w=2*pi*n./T;
n@[&SgZq g1=-i*ww./2;
jt-Cy g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
ehQ"<.sQ g3=-i*ww./2;
in_~,fd P1=0;
t3!?F(& P2=0;
Gv(bD6Rz P3=1;
t_1a.Jv P=0;
+grIw#j for m1=1:M1
=pQA!u]QE p=0.032*m1; %input amplitude
NBzyP)2) s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
1SoKnfz{6 s1=s10;
kylR) s20=0.*s10; %input in waveguide 2
37'@,*m` s30=0.*s10; %input in waveguide 3
ZzET8?8 s2=s20;
?r"][< s3=s30;
iQsv^K!\ p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
%''z~LzJ8 %energy in waveguide 1
4Eh 2sI p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
6B
4Sd %energy in waveguide 2
'vKB]/e; p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
Q7oJ4rIP %energy in waveguide 3
:|/bEP]p/ for m3 = 1:1:M3 % Start space evolution
Cw1Jl5OVZ s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
c(jF^
0~ s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
*gRg--PY% s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
Erz{{kf]1V sca1 = fftshift(fft(s1)); % Take Fourier transform
&>kklP sca2 = fftshift(fft(s2));
]37k\O?vd sca3 = fftshift(fft(s3));
W!B4~L sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
j.O7-t%C sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
5|2v6W!e sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
OM5"&ZIZb s3 = ifft(fftshift(sc3));
g7!P| s2 = ifft(fftshift(sc2)); % Return to physical space
yGl
(QLk s1 = ifft(fftshift(sc1));
Ezw(J[).C end
z^=.05jB p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
Zj;2> p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
?d`?Ss;v p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
W70J2 P1=[P1 p1/p10];
Ql8E9~h P2=[P2 p2/p10];
/VB n P3=[P3 p3/p10];
OMG.64DX . P=[P p*p];
P7r?rbO" end
seWYY $$ figure(1)
Yjxa=CD plot(P,P1, P,P2, P,P3);
~@=:I 5
OR L 转自:
http://blog.163.com/opto_wang/