计算脉冲在非线性耦合器中演化的Matlab 程序 +]A+!8%Z }/_('q@s\ % This Matlab script file solves the coupled nonlinear Schrodinger equations of
o~Bk0V= % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
]&&I|K_ % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
8dr0 DF$c % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
;n3uV`\ |}M~kJ) %fid=fopen('e21.dat','w');
p^p'/$<6_ N = 128; % Number of Fourier modes (Time domain sampling points)
mw:3q6 M1 =3000; % Total number of space steps
CbnR<W-j J =100; % Steps between output of space
DfAiL( T =10; % length of time windows:T*T0
u86J.K1Q T0=0.1; % input pulse width
/Lq;w'|I MN1=0; % initial value for the space output location
+`Q
PBj^ dt = T/N; % time step
^ze@#Cp n = [-N/2:1:N/2-1]'; % Index
w~bG<kxP t = n.*dt;
_pY u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
gUksO!7^1 u20=u10.*0.0; % input to waveguide 2
F?}m8ZRv u1=u10; u2=u20;
d [\>'> U1 = u1;
B$K7L'e+- U2 = u2; % Compute initial condition; save it in U
mJwv&E ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
2AdX)iF@ w=2*pi*n./T;
@#bBs9@gv g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
1h#w"4 L=4; % length of evoluation to compare with S. Trillo's paper
7yY1dR<Y dz=L/M1; % space step, make sure nonlinear<0.05
{Uik| for m1 = 1:1:M1 % Start space evolution
{%]NpFg#b u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
Wwn5LlJ^ u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
G/x3wR ca1 = fftshift(fft(u1)); % Take Fourier transform
|usnY ca2 = fftshift(fft(u2));
~0VwF c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
/V#MLPA c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
0!3!?E < u2 = ifft(fftshift(c2)); % Return to physical space
wo,""=l u1 = ifft(fftshift(c1));
;n yB if rem(m1,J) == 0 % Save output every J steps.
B|$\/xO U1 = [U1 u1]; % put solutions in U array
V/QTYy1 U2=[U2 u2];
,gAr|x7_ MN1=[MN1 m1];
OGSEvfW z1=dz*MN1'; % output location
eLHa9R{)B end
o`<h=+a\ end
J,dG4.ht hg=abs(U1').*abs(U1'); % for data write to excel
')5jllxv ha=[z1 hg]; % for data write to excel
v:'P"uU;4 t1=[0 t'];
')C_An>X6 hh=[t1' ha']; % for data write to excel file
S&4w`hdD>~ %dlmwrite('aa',hh,'\t'); % save data in the excel format
[8V(N2
figure(1)
S*~Na]nS0 waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
LM'*OtpDG figure(2)
pl1EJ < waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
Vp- n(Z uAPLT~ 非线性超快脉冲耦合的数值方法的Matlab程序 EvGU j$ Og&0Z)% 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
dK=D=5r, 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
D{&+7C:8. Gaw,1Ow!`2 (&N$W& iTKG,$G % This Matlab script file solves the nonlinear Schrodinger equations
yK @X^jf % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
e+]YCp[( % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
KweHY, % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
OTy4"% K>DnD0 C=1;
I'6ed`| M1=120, % integer for amplitude
hj#+8= M3=5000; % integer for length of coupler
e\|E; l N = 512; % Number of Fourier modes (Time domain sampling points)
eBLHT dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
\fQgiX T =40; % length of time:T*T0.
YA8yMh*4D? dt = T/N; % time step
U4mh! n = [-N/2:1:N/2-1]'; % Index
*$WiJ3'(m t = n.*dt;
['9OGV\ ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
)Or:wFSMq w=2*pi*n./T;
<R]Wy}2- g1=-i*ww./2;
[{.\UkV@ g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
P[J qJi/H g3=-i*ww./2;
FdK R{dX} P1=0;
ggYIq*4 P2=0;
c,u$tnE) P3=1;
5qODS_Eq P=0;
Liz6ob for m1=1:M1
=f{Z~`3 p=0.032*m1; %input amplitude
\-`oFe" s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
A.'`FtV s1=s10;
~9{-I{= s20=0.*s10; %input in waveguide 2
(WU~e!} s30=0.*s10; %input in waveguide 3
G){1`gAhNJ s2=s20;
5SPl#*W s3=s30;
ph$&f0A6Xc p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
qz_TcU' %energy in waveguide 1
Q:xI}
]FM p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
>5z`SZf %energy in waveguide 2
n6-!@RYr p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
&hM,b!R| %energy in waveguide 3
$K>d \{@+7 for m3 = 1:1:M3 % Start space evolution
{<V|Gr s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
,:Y=,[ n s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
8aM%
9OU s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
mrBhvp"" sca1 = fftshift(fft(s1)); % Take Fourier transform
EXM/>PG sca2 = fftshift(fft(s2));
oY#XWe8Om sca3 = fftshift(fft(s3));
w]}cB+C+l# sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
OG<]`!" sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
C(Bar# sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
MrygEC 5 s3 = ifft(fftshift(sc3));
y`P7LC s2 = ifft(fftshift(sc2)); % Return to physical space
?wiq
3f 6 s1 = ifft(fftshift(sc1));
t6U+a\-< end
CI]U)@\U p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
+Y%I0.?&5 p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
Z~R/p;@ p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
Z(clw P1=[P1 p1/p10];
XS~w_J#q P2=[P2 p2/p10];
9%hB P3=[P3 p3/p10];
]KII?{<k P=[P p*p];
IU"!oM ^ end
(h(ZL9! figure(1)
orN2(:Ct7 plot(P,P1, P,P2, P,P3);
5D@Q1 SEn8t"n 转自:
http://blog.163.com/opto_wang/