计算脉冲在非线性耦合器中演化的Matlab 程序 ^(TCUY~f& '^)'q\v'k % This Matlab script file solves the coupled nonlinear Schrodinger equations of
=CFjG)L % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
c
\??kQH % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
}K) AjZ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
]ePg6 1e[?}q]* %fid=fopen('e21.dat','w');
c= t4 gf N = 128; % Number of Fourier modes (Time domain sampling points)
\NNA" M1 =3000; % Total number of space steps
dLYM )-H`> J =100; % Steps between output of space
Wq3PN^ T =10; % length of time windows:T*T0
""7H;I& T0=0.1; % input pulse width
1<vJuF^ MN1=0; % initial value for the space output location
(/uN+ dt = T/N; % time step
J~KO#` n = [-N/2:1:N/2-1]'; % Index
OFr"RGW" t = n.*dt;
9C \}bT u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
$?F_Qsy{d u20=u10.*0.0; % input to waveguide 2
}`L;.9 u1=u10; u2=u20;
C+/EPPi U1 = u1;
Lz1KDXr`)+ U2 = u2; % Compute initial condition; save it in U
S!A:/(^WB ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
V<WWtu;3 w=2*pi*n./T;
)s>|;K{ g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
oL~1M=r L=4; % length of evoluation to compare with S. Trillo's paper
}$<v dz=L/M1; % space step, make sure nonlinear<0.05
WblH} for m1 = 1:1:M1 % Start space evolution
N_
ODr]L u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
Vl$RMW@Ds u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
0 @#Jz#? ca1 = fftshift(fft(u1)); % Take Fourier transform
K_+M?ap_ ca2 = fftshift(fft(u2));
N|mggz c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
,$!fyi[;C c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
+On2R&m u2 = ifft(fftshift(c2)); % Return to physical space
7d.H8C2 u1 = ifft(fftshift(c1));
h*^JFZb if rem(m1,J) == 0 % Save output every J steps.
IsT}T}p,t U1 = [U1 u1]; % put solutions in U array
zr ez* U2=[U2 u2];
}'vQUGu8z MN1=[MN1 m1];
9=}#.W3. z1=dz*MN1'; % output location
1;m?:|6K{ end
\#biwX end
5xr2 hg=abs(U1').*abs(U1'); % for data write to excel
=,*/Ph& ha=[z1 hg]; % for data write to excel
V #vkj t1=[0 t'];
yx#!2Z0hw hh=[t1' ha']; % for data write to excel file
W
~MNst? %dlmwrite('aa',hh,'\t'); % save data in the excel format
G-D}J2r=F figure(1)
&u9,|n]O9 waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
j7);N figure(2)
A]iT
uu5 p waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
Gmu[UI}w8 UHV"<9tk 非线性超快脉冲耦合的数值方法的Matlab程序 }qGd*k0F0 X%I@4 B7Ts 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
qCVb-f 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
]hlQU%& k3LHLJZ# 0{d)f1 d?5oJ'JU % This Matlab script file solves the nonlinear Schrodinger equations
xGOmvn^lQ % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
DQ$m@_/4w % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
~d<&OL % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
k0FAI0~( n2o)K;wW+ C=1;
B{`K?e0 M1=120, % integer for amplitude
-m,Y6 M3=5000; % integer for length of coupler
$2]>{g N = 512; % Number of Fourier modes (Time domain sampling points)
K
d#(eGe dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
P7X3>5<;q T =40; % length of time:T*T0.
Wf?[GO dt = T/N; % time step
HXh:83 n = [-N/2:1:N/2-1]'; % Index
<QgpePyoN t = n.*dt;
o=![+g ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
asQ^33g z w=2*pi*n./T;
"\lOOp^- g1=-i*ww./2;
Bvj g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
_^?_Vb g3=-i*ww./2;
>C{8}Lg-. P1=0;
Y ajAz5N P2=0;
VeEa17g& P3=1;
lP4s"8E`h P=0;
c8zok `\P_ for m1=1:M1
25 U+L p=0.032*m1; %input amplitude
,9KnC=_y s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
_b)Ie`a.H s1=s10;
am'K$s s20=0.*s10; %input in waveguide 2
)yz)Fw|& s30=0.*s10; %input in waveguide 3
kTzO4s? s2=s20;
6 %` h2Z s3=s30;
r_8;aPL p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
`Y!8,(5# %energy in waveguide 1
=Y^K
p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
\,m*CYs` %energy in waveguide 2
O#!|2qN p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
^VnnYtCRz %energy in waveguide 3
00-2u~D& for m3 = 1:1:M3 % Start space evolution
pL*aU=FjQ s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
}YiFiGf, s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
00>knCe6 s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
JS?%zj&@ sca1 = fftshift(fft(s1)); % Take Fourier transform
0XC3O 8q sca2 = fftshift(fft(s2));
benqm ~{\ sca3 = fftshift(fft(s3));
@tRDKPh sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
Ew;AYZX sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
svt3gkR0 sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
}0/l48G s3 = ifft(fftshift(sc3));
))X"bFP!3 s2 = ifft(fftshift(sc2)); % Return to physical space
39pA:3iTd s1 = ifft(fftshift(sc1));
EIpz-"S end
1=X1<@* p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
~XXNzz]? p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
AYsHA w p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
g^#,!e P1=[P1 p1/p10];
#N"QTD|i P2=[P2 p2/p10];
O"X7 DgbC P3=[P3 p3/p10];
pFBK'NE P=[P p*p];
m}beT~FT_ end
4kK_S.& figure(1)
zDxJK plot(P,P1, P,P2, P,P3);
E8lq2r= p&2d&;Qo0 转自:
http://blog.163.com/opto_wang/