计算脉冲在非线性耦合器中演化的Matlab 程序 [uie]*^ b2F1^]p % This Matlab script file solves the coupled nonlinear Schrodinger equations of
PK?}hz % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
ZQz;EV! % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
<C"}OW8 % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
(#je0ES +f]I7e:qp %fid=fopen('e21.dat','w');
:1iXBG\ N = 128; % Number of Fourier modes (Time domain sampling points)
%iV\nFal> M1 =3000; % Total number of space steps
cEJ_z(\=hr J =100; % Steps between output of space
mMhe,8E& T =10; % length of time windows:T*T0
/KvpJ4 T0=0.1; % input pulse width
~|KMxY(: MN1=0; % initial value for the space output location
QBoX3w= dt = T/N; % time step
8v;T_VN n = [-N/2:1:N/2-1]'; % Index
`~=Is.V[ t = n.*dt;
l%2B4d9"v u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
R<h0RKiM@ u20=u10.*0.0; % input to waveguide 2
8r\xQr'8h u1=u10; u2=u20;
Eh_[8:dK U1 = u1;
-IV-"-6( U2 = u2; % Compute initial condition; save it in U
&E
k\ ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
^eYJ7&t w=2*pi*n./T;
r:^`005 g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
yNx"Ey dk` L=4; % length of evoluation to compare with S. Trillo's paper
=(k0^#++G dz=L/M1; % space step, make sure nonlinear<0.05
>W8PLo+i for m1 = 1:1:M1 % Start space evolution
hi]\M)l&x u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
KRcg u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
Y50$2%kM ca1 = fftshift(fft(u1)); % Take Fourier transform
V|0UwS\n ca2 = fftshift(fft(u2));
Ox/va]e7" c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
oWOH #w c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
p@znmn- u2 = ifft(fftshift(c2)); % Return to physical space
C$B?|oUJc u1 = ifft(fftshift(c1));
s3T 6"%S` if rem(m1,J) == 0 % Save output every J steps.
zwHTtE U1 = [U1 u1]; % put solutions in U array
9Bmgz =8 U2=[U2 u2];
w@f_TG"Vt MN1=[MN1 m1];
WHF:>0B z1=dz*MN1'; % output location
`[1]wV5(5@ end
==j39 end
PsD]gN5" hg=abs(U1').*abs(U1'); % for data write to excel
&9g#Vq% ha=[z1 hg]; % for data write to excel
3?/} t1=[0 t'];
&l|B>{4v hh=[t1' ha']; % for data write to excel file
WI'csM;M# %dlmwrite('aa',hh,'\t'); % save data in the excel format
|b7>kM}" figure(1)
*XzUqK waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
1r w>gR figure(2)
9p$q@Bc waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
;6)|'3.B9 ^jhHaN]G^ 非线性超快脉冲耦合的数值方法的Matlab程序 bm7$D Kp# anV)$PT= 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
j({L6</x 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
gA) F qC|re!K %F/tbXy{ wy&*6>. % This Matlab script file solves the nonlinear Schrodinger equations
;[zx'e?! % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
p0YTZS ]h % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
CC87<>V % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
>\p}UPx Ul@'z| C=1;
y! 1NS M1=120, % integer for amplitude
<?nr"V M3=5000; % integer for length of coupler
6<~y!\4;F N = 512; % Number of Fourier modes (Time domain sampling points)
+yea}uUE dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
EX5kF T =40; % length of time:T*T0.
Tp6ysjao dt = T/N; % time step
F^~#D, \ n = [-N/2:1:N/2-1]'; % Index
jKQP0 t- t = n.*dt;
G`W+m*[U+M ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
1-[{4{R w=2*pi*n./T;
&]c9}Ic g1=-i*ww./2;
?3, * g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
LOYv%9$0*p g3=-i*ww./2;
(6+0U1[Iz P1=0;
Tuy*Df P2=0;
~gDtj&F P3=1;
]-`{kX P=0;
gddGl=rm for m1=1:M1
zj)[Sntn? p=0.032*m1; %input amplitude
O&0R ~<n s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
Q&\k"X 1 s1=s10;
eK@Y] !lz s20=0.*s10; %input in waveguide 2
>) ^!gz8 s30=0.*s10; %input in waveguide 3
zc(7p;w#p s2=s20;
Mt:(w;Y s3=s30;
\dMsv1\ p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
jHZ<Gc %energy in waveguide 1
8YJ({ Ou_ p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
$_UF9l0 %energy in waveguide 2
&Gt9a-ne p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
;g*6NzdA %energy in waveguide 3
Vqr&)i"b$ for m3 = 1:1:M3 % Start space evolution
j?(QieBH s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
w$!n8Aqs s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
-|kDa1knA s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
f<'C<xnf sca1 = fftshift(fft(s1)); % Take Fourier transform
RPWYm sca2 = fftshift(fft(s2));
;vx9xs?6 sca3 = fftshift(fft(s3));
%"6IAt sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
G#C)]4[n sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
StVv"YY sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
s5dh]vNN s3 = ifft(fftshift(sc3));
'37b[~k4 s2 = ifft(fftshift(sc2)); % Return to physical space
koU.`l. s1 = ifft(fftshift(sc1));
b,W'0gl end
8K/lpqw p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
Kna'5L5" p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
5W48z%MN
p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
Z-?9F`} P1=[P1 p1/p10];
)wRD P2=[P2 p2/p10];
CAA~VEUL P3=[P3 p3/p10];
!|/fVWH P=[P p*p];
[`lAc V< end
BSY#xe V figure(1)
-iHhpD9"X plot(P,P1, P,P2, P,P3);
U{Z>y?V/ yN.D(ZwF: 转自:
http://blog.163.com/opto_wang/