计算脉冲在非线性耦合器中演化的Matlab 程序 #GDe08rOw zk*c)s % This Matlab script file solves the coupled nonlinear Schrodinger equations of
r_e7a6 % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
^EG\iO2X % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
c gzwx % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
km^^T_ M/ 'Jf^`ZT} %fid=fopen('e21.dat','w');
KDl_?9E5 N = 128; % Number of Fourier modes (Time domain sampling points)
")O`mXg- M1 =3000; % Total number of space steps
@_:]J1jw7 J =100; % Steps between output of space
?m$a6'2-,J T =10; % length of time windows:T*T0
53-v|'9' T0=0.1; % input pulse width
ac kqH+' MN1=0; % initial value for the space output location
"H-" dt = T/N; % time step
{~|OE-X][ n = [-N/2:1:N/2-1]'; % Index
jdE5~a+ t = n.*dt;
XU/QA
[K u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
w.,Q1\*rPp u20=u10.*0.0; % input to waveguide 2
LK6; ?m u1=u10; u2=u20;
)o-Q!<*1 U1 = u1;
ZxV"(\$n U2 = u2; % Compute initial condition; save it in U
I$E.s*B9 ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
s&\I=J. w=2*pi*n./T;
Y6,Rj:8 g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
1]IQg;q L=4; % length of evoluation to compare with S. Trillo's paper
~4P%%b0,o dz=L/M1; % space step, make sure nonlinear<0.05
I;Vu W for m1 = 1:1:M1 % Start space evolution
FnJ?C&xK u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
V $z}
K u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
{ hln?' ca1 = fftshift(fft(u1)); % Take Fourier transform
p!k7C&]E ca2 = fftshift(fft(u2));
lds-T c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
54
> - c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
!mWiYpbU+ u2 = ifft(fftshift(c2)); % Return to physical space
O6IB.
>T u1 = ifft(fftshift(c1));
5~mh'<: if rem(m1,J) == 0 % Save output every J steps.
=K{\p`? U1 = [U1 u1]; % put solutions in U array
TuW %zF/ U2=[U2 u2];
`tjH< MN1=[MN1 m1];
GA7}K:LP'k z1=dz*MN1'; % output location
6JKqn~0Kk end
JQ4{` =,b end
Qs9gTBS; hg=abs(U1').*abs(U1'); % for data write to excel
}%Bl>M ha=[z1 hg]; % for data write to excel
?wnzTbJN t1=[0 t'];
OKFtl hh=[t1' ha']; % for data write to excel file
J'N!Omz %dlmwrite('aa',hh,'\t'); % save data in the excel format
[D*UT#FM figure(1)
H[DUZ,J waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
r}uz7}z %" figure(2)
,V*%V; waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
PJ='tJDj lNQcYv 非线性超快脉冲耦合的数值方法的Matlab程序 -V: "l ]p_@@QTC 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
<7-J0btV 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
35tu>^_#V gY@N~'f;" UI>Y0O ~I{n^Q/a % This Matlab script file solves the nonlinear Schrodinger equations
&ZL3{M % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
w`q%#qRk % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
;j4?>3 % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
Nbp!teH6 !9xp cQ> C=1;
Q>n|^y6 M1=120, % integer for amplitude
tU_y6 M3=5000; % integer for length of coupler
M`ip~7" N = 512; % Number of Fourier modes (Time domain sampling points)
cI=(\pC dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
v%fu T =40; % length of time:T*T0.
h,Q3oy\s1 dt = T/N; % time step
A45A:hqs n = [-N/2:1:N/2-1]'; % Index
ei
rzYt t = n.*dt;
<vXGi ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
)c8j} w=2*pi*n./T;
/%Nr?V g1=-i*ww./2;
hGiz)v~ g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
H<^/Ati,| g3=-i*ww./2;
.l@xsJn P1=0;
|Pg@M P2=0;
Offu9`DiZ P3=1;
g55`A`5%C P=0;
_cu:aktf2 for m1=1:M1
jAud {m*T p=0.032*m1; %input amplitude
/{|fyKo\? s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
Zfyo-Wk s1=s10;
L:9F:/G s20=0.*s10; %input in waveguide 2
H/Llj.-jg s30=0.*s10; %input in waveguide 3
< P`u} s2=s20;
K# Jk _"W s3=s30;
L(U"U#QZ p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
Fy.\7CL> %energy in waveguide 1
5< ja3 p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
@'|)~,"bx %energy in waveguide 2
.-<k>9S7_ p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
1bH;!J %energy in waveguide 3
0Q^Ikiv for m3 = 1:1:M3 % Start space evolution
Uf, 4 s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
U4cY_p? s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
sVl-N&/ s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
+).0cs0k5 sca1 = fftshift(fft(s1)); % Take Fourier transform
gH G sca2 = fftshift(fft(s2));
{uHU]6d3qy sca3 = fftshift(fft(s3));
0=K9`=5d0 sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
9ksE>[7 sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
'{(UW.Awo sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
D_x+:1( s3 = ifft(fftshift(sc3));
;s52{>&F] s2 = ifft(fftshift(sc2)); % Return to physical space
~{Mn{ s1 = ifft(fftshift(sc1));
3"P }n end
{6}eN|4~# p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
?yj6CL(, p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
P><o,s"v p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
e/^=U7:io P1=[P1 p1/p10];
kS!viJwtT P2=[P2 p2/p10];
VH[hsj P3=[P3 p3/p10];
PK"c4>q P=[P p*p];
$_x^lr end
m'f,_ \' figure(1)
0A( +ZMd plot(P,P1, P,P2, P,P3);
;f"0~D2 B`
k\ EL' 转自:
http://blog.163.com/opto_wang/