计算脉冲在非线性耦合器中演化的Matlab 程序 8xv\Zj + ?yU#'`q % This Matlab script file solves the coupled nonlinear Schrodinger equations of
K@,VR3y / % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
gJ7$G3&oZg % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
evR= Z\
_ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
2X]\:<[4 Y5 opZG %fid=fopen('e21.dat','w');
lt4UNJ3w N = 128; % Number of Fourier modes (Time domain sampling points)
5a~1RL M1 =3000; % Total number of space steps
Xo5L:(?K J =100; % Steps between output of space
w '"7~uN T =10; % length of time windows:T*T0
P}I*SV0 T0=0.1; % input pulse width
5jLDe~ MN1=0; % initial value for the space output location
pZjFpd| dt = T/N; % time step
CP'-CQ\Q n = [-N/2:1:N/2-1]'; % Index
hJ@nW5CI t = n.*dt;
<>Im$N ai u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
Uoe?5Of(* u20=u10.*0.0; % input to waveguide 2
Z4!3I@yZ u1=u10; u2=u20;
zW _'sC U1 = u1;
AK!G#ug U2 = u2; % Compute initial condition; save it in U
pi{ahuI#_o ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
3IkG*enI w=2*pi*n./T;
8HOmWQS g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
;1 fM L,8 L=4; % length of evoluation to compare with S. Trillo's paper
)'g vaT dz=L/M1; % space step, make sure nonlinear<0.05
^n]s}t}csV for m1 = 1:1:M1 % Start space evolution
3:(`#YY u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
6>Cubb> u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
}VGiT~2$ ca1 = fftshift(fft(u1)); % Take Fourier transform
]VME`]t` ca2 = fftshift(fft(u2));
Bz{
g4!ku c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
D4|_?O3|m c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
'zb7:[[7% u2 = ifft(fftshift(c2)); % Return to physical space
k
y98/6 u1 = ifft(fftshift(c1));
uE$o4X if rem(m1,J) == 0 % Save output every J steps.
5ZVTI,4K U1 = [U1 u1]; % put solutions in U array
1 W u U2=[U2 u2];
M@\'Y$)Y{ MN1=[MN1 m1];
Fk(5y) z1=dz*MN1'; % output location
cOQy|v`KD, end
t/Fe"T[,V end
"ir*;| hg=abs(U1').*abs(U1'); % for data write to excel
n3N"Ax ha=[z1 hg]; % for data write to excel
qHCs{ u t1=[0 t'];
x_K% hh=[t1' ha']; % for data write to excel file
bv/b<N@4?$ %dlmwrite('aa',hh,'\t'); % save data in the excel format
u_BSWhiW figure(1)
Q
Y'-] waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
n1Jz49[r figure(2)
w%;'uN_ waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
MQ44uHJ F
4/Uu"J: 非线性超快脉冲耦合的数值方法的Matlab程序 Sg-xm+iSDt /Hmo!"W` 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
MlFvDy 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
7;NV
1RV j,XKu5w)Oi 3U)8P6Fz (Y([^N q % This Matlab script file solves the nonlinear Schrodinger equations
+0Gep}&z. % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
Pc'?p % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
Bv8C_-lV/ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
''uI+>Y m+vEs,W. C=1;
sd53 _sV M1=120, % integer for amplitude
BvF_9 M3=5000; % integer for length of coupler
Q8?D}h N = 512; % Number of Fourier modes (Time domain sampling points)
W#j,{&KVn dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
+`8)U 3u0 T =40; % length of time:T*T0.
>nQyF dt = T/N; % time step
mx~sxYa n = [-N/2:1:N/2-1]'; % Index
k5D'RD t = n.*dt;
]'(7T# ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
I?>T"nV +' w=2*pi*n./T;
Tm\[q g1=-i*ww./2;
BA,6f?ktXS g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
8n5nHne g3=-i*ww./2;
C`wI6! P1=0;
D}sGBsOW P2=0;
_eV n#!| P3=1;
)1Nnn P=0;
cg00t+ for m1=1:M1
OL5HofgNm p=0.032*m1; %input amplitude
4/?}xD|? s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
Hs=N0Sk]j s1=s10;
4Z9wzQ> s20=0.*s10; %input in waveguide 2
<C;>$kX s30=0.*s10; %input in waveguide 3
"R@N|Qx' s2=s20;
a
+yI2s4Z s3=s30;
UUu-(H-J p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
x9l0UD*+g %energy in waveguide 1
vN:[ p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
<0)ud)~u %energy in waveguide 2
?K {1S p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
Wxau]uix %energy in waveguide 3
?7)(qnbe" for m3 = 1:1:M3 % Start space evolution
^!o}>ls[' s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
8zDH<Gb s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
BK9x`Oo 2 s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
$'YKB8C sca1 = fftshift(fft(s1)); % Take Fourier transform
ir:~*| sca2 = fftshift(fft(s2));
y*h1W4:^- sca3 = fftshift(fft(s3));
l/zC##1+. sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
bDBO+qA sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
W#I:j: p sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
qlITQKGG s3 = ifft(fftshift(sc3));
6h6?BQSE s2 = ifft(fftshift(sc2)); % Return to physical space
rw[ {@|)'z s1 = ifft(fftshift(sc1));
V<ApHb end
OP`Jc$|6 p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
nVn|$ "r p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
l@rwf$- p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
r>~d[,^$m4 P1=[P1 p1/p10];
jS3(> P2=[P2 p2/p10];
ttFY
_F~S P3=[P3 p3/p10];
RB7AI!'a? P=[P p*p];
`k]!6osZo end
|W*@}D figure(1)
|F@xwfgb plot(P,P1, P,P2, P,P3);
PuZs5J3 ()M@3={R 转自:
http://blog.163.com/opto_wang/