计算脉冲在非线性耦合器中演化的Matlab 程序 #cR57=M} HE9.
k.sS % This Matlab script file solves the coupled nonlinear Schrodinger equations of
Ua}g % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
?exALv'B % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
*
.oi3m % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
Lqg7D\7j x/pC%25 %fid=fopen('e21.dat','w');
VOD1xWrb N = 128; % Number of Fourier modes (Time domain sampling points)
7l[t9ON M1 =3000; % Total number of space steps
Uy:@,DW J =100; % Steps between output of space
no eb f T =10; % length of time windows:T*T0
^.nwc# T0=0.1; % input pulse width
h\Z3y AYd MN1=0; % initial value for the space output location
=#7s+ d- dt = T/N; % time step
.0rJIO n = [-N/2:1:N/2-1]'; % Index
R9S7_u t = n.*dt;
3xc:Y>
*` u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
~Ay u20=u10.*0.0; % input to waveguide 2
?U7&R%Lh` u1=u10; u2=u20;
Z`e$~n(Bh U1 = u1;
f:)]FHPB1 U2 = u2; % Compute initial condition; save it in U
F^4*|g ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
9?EY.}~ w=2*pi*n./T;
|j\eBCnH3 g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
=f/avGX L=4; % length of evoluation to compare with S. Trillo's paper
1Al=v dz=L/M1; % space step, make sure nonlinear<0.05
jJiCF,m for m1 = 1:1:M1 % Start space evolution
<h)deB+} u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
D7 8)4>X u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
(\5<GCW- ca1 = fftshift(fft(u1)); % Take Fourier transform
cuJ/ Vc ca2 = fftshift(fft(u2));
2n<qAl$t c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
ZYpD8u6U c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
r>n8`W u2 = ifft(fftshift(c2)); % Return to physical space
hg)!m\g u1 = ifft(fftshift(c1));
XyN`BDFi if rem(m1,J) == 0 % Save output every J steps.
_Eet2;9 U1 = [U1 u1]; % put solutions in U array
e!O &~#'h} U2=[U2 u2];
9 ayH:; MN1=[MN1 m1];
O:5ldI z1=dz*MN1'; % output location
pZNlcB[Qn- end
C{lB/F/|! end
x`&P}4v0 hg=abs(U1').*abs(U1'); % for data write to excel
6'3Ey'drH ha=[z1 hg]; % for data write to excel
CJ37:w{%*Y t1=[0 t'];
B$iMU?B3 hh=[t1' ha']; % for data write to excel file
zwF7DnW<< %dlmwrite('aa',hh,'\t'); % save data in the excel format
&k {t0> figure(1)
nJnO/~| waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
^ ^U)WB figure(2)
pJ<)intcbE waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
qCv}+d) zXA= se0U 非线性超快脉冲耦合的数值方法的Matlab程序 2l;ge>DJ lW@:q04Z$ 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
IWSEssP 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
&AkzSgP `0-m`> 1> Xl gz.j7XR HvL9;^! % This Matlab script file solves the nonlinear Schrodinger equations
6Wcn(h8%* % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
(rCPr,@0 % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
?j
; ,q % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
Lt
ZWs0l0 zjhR9 C=1;
`jl. f M1=120, % integer for amplitude
_'o^@v: M3=5000; % integer for length of coupler
rSzXa4m( N = 512; % Number of Fourier modes (Time domain sampling points)
^!{ o Azy9 dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
QyBK*uNdV T =40; % length of time:T*T0.
$(!D/bvJ dt = T/N; % time step
pNk,jeo n = [-N/2:1:N/2-1]'; % Index
_16&K}< t = n.*dt;
9fk\Ay1P ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
.,(uoK{ w=2*pi*n./T;
kgib$t_7 g1=-i*ww./2;
`XRb:d^ g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
7cQHRM+1 g3=-i*ww./2;
_a:!U^4 P1=0;
:D)&>{? P2=0;
ocuNrkZ P3=1;
>H]|A<9u( P=0;
~P.-3 for m1=1:M1
pR^Y|NG! p=0.032*m1; %input amplitude
jmwQc& s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
=iQ`F$M s1=s10;
Toa#>Z*+Rb s20=0.*s10; %input in waveguide 2
DdA}A>47 s30=0.*s10; %input in waveguide 3
0zkT8'v s2=s20;
WG!;,~f>o s3=s30;
8aIq#v p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
Ny&Fjzl %energy in waveguide 1
9jJ/ RX p p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
t+Q|l&|0 %energy in waveguide 2
x%Y a*T p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
MsVI <+JZ %energy in waveguide 3
APOU&Wd for m3 = 1:1:M3 % Start space evolution
7Q4PjcD s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
mk3e^,[A s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
Z6
|'k:R8 s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
qCFXaj
sca1 = fftshift(fft(s1)); % Take Fourier transform
d$C|hT sca2 = fftshift(fft(s2));
;),O*Z|"v sca3 = fftshift(fft(s3));
0jx~_zq-j sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
^zs4tCW % sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
jn3|9x sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
vdX~E97 s3 = ifft(fftshift(sc3));
1*Fvx-U' s2 = ifft(fftshift(sc2)); % Return to physical space
8=_| qy}l/ s1 = ifft(fftshift(sc1));
kl<B*:RqH end
b"3T(#2<* p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
JnKbd~ p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
}R] }@i~i p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
~k<31 ez P1=[P1 p1/p10];
as47eZ0\ P2=[P2 p2/p10];
Bv|9{:1%X} P3=[P3 p3/p10];
*,=+R$ P=[P p*p];
NCh(-E end
9;WOqBD figure(1)
\:)o'- plot(P,P1, P,P2, P,P3);
}\qdow- g|*eN{g]uE 转自:
http://blog.163.com/opto_wang/