计算脉冲在非线性耦合器中演化的Matlab 程序 w~Tg?RH: t G_4>-Y#w % This Matlab script file solves the coupled nonlinear Schrodinger equations of
f$I=oN % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
'a#lBzu\b % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
zPt<b!q % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
YT(N][V h"FI]jK|} %fid=fopen('e21.dat','w');
VD=H=Ju N = 128; % Number of Fourier modes (Time domain sampling points)
br I;}m M1 =3000; % Total number of space steps
*X0>Ru[ J =100; % Steps between output of space
3H2~?CaJ T =10; % length of time windows:T*T0
"O34 E?ql. T0=0.1; % input pulse width
!XPjRd q MN1=0; % initial value for the space output location
M2Q,&>M
dt = T/N; % time step
HP# SR';E n = [-N/2:1:N/2-1]'; % Index
Af3|l t = n.*dt;
@*z"Hi>4 u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
$*q|}Tvl# u20=u10.*0.0; % input to waveguide 2
Tmzbh 9
u1=u10; u2=u20;
]?^V xB7L U1 = u1;
<)7aNW. U2 = u2; % Compute initial condition; save it in U
JR!-1tnc ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
=%<=Bn w=2*pi*n./T;
U5Hi9fe g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
"*d6E}wG L=4; % length of evoluation to compare with S. Trillo's paper
<KMCNCU\+ dz=L/M1; % space step, make sure nonlinear<0.05
*5)UIRd for m1 = 1:1:M1 % Start space evolution
VN`.*B|9[ u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
3FBL CD3 u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
'Lu<2=a~ ca1 = fftshift(fft(u1)); % Take Fourier transform
EI_-5Tt RD ca2 = fftshift(fft(u2));
Oeh A3$|# c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
PaCCUF c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
hRf
l\Q[ u2 = ifft(fftshift(c2)); % Return to physical space
8t!jo.g u1 = ifft(fftshift(c1));
^/C\:hw if rem(m1,J) == 0 % Save output every J steps.
OZ&/&?!XE U1 = [U1 u1]; % put solutions in U array
yqN`R\d U2=[U2 u2];
=B}IsBn'J MN1=[MN1 m1];
gFR}WBl/ z1=dz*MN1'; % output location
pGs?Y81
end
ciS +.%7 end
~F"S] hg=abs(U1').*abs(U1'); % for data write to excel
M9iX_4 ha=[z1 hg]; % for data write to excel
H^d?(Svh t1=[0 t'];
/.]u%;%r[ hh=[t1' ha']; % for data write to excel file
E ;Z(v %dlmwrite('aa',hh,'\t'); % save data in the excel format
+ktv:d figure(1)
6KddHyFz waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
D ,kxB~ figure(2)
u
W]gBhO$O waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
qPDNDkjDD N@d~gE&^ 非线性超快脉冲耦合的数值方法的Matlab程序 5wue2/gl aC1z.?!U 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
p%DU1+SA 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
V0;"Qa@q Bsa;, $8\u N<Sl88+U % This Matlab script file solves the nonlinear Schrodinger equations
iT'doF % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
m)A:w.o % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
2 7)IfE % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
S~ /2Bw!2 yrxX[Hg?@ C=1;
=Kj{wA
O M1=120, % integer for amplitude
gX"-3w M3=5000; % integer for length of coupler
2Q e&FeT N = 512; % Number of Fourier modes (Time domain sampling points)
3Q,&D'];[ dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
'8 .JnCg T =40; % length of time:T*T0.
T=PqA)Ym dt = T/N; % time step
wO]e%BTO n = [-N/2:1:N/2-1]'; % Index
R+HX'W t = n.*dt;
kL DpZ{ ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
8H7#[?F w=2*pi*n./T;
\ ca<L g1=-i*ww./2;
?^U? ua6 g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
r D@*xMW g3=-i*ww./2;
%`i*SF(gV P1=0;
]N 9N][n P2=0;
"qgwuWbM P3=1;
|%|03}Q P=0;
,:mL\ZED for m1=1:M1
e]VW\6J& p=0.032*m1; %input amplitude
t+v%%N_ s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
==Egy:<:Q s1=s10;
G2|jS@L# s20=0.*s10; %input in waveguide 2
{py%-W s30=0.*s10; %input in waveguide 3
B@*b 9 s2=s20;
N**)8( s3=s30;
LDQ,SS, p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
!q+ #JW %energy in waveguide 1
dFBFXy p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
0`"oR3JY %energy in waveguide 2
p3vf7 eqn p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
PA'&]piPl: %energy in waveguide 3
x'g4DYl for m3 = 1:1:M3 % Start space evolution
uH*6@aYPo s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
\-yI
dKj s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
f-18nF7{ s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
m ""+$ sca1 = fftshift(fft(s1)); % Take Fourier transform
]EKg)E sca2 = fftshift(fft(s2));
glLVT
i sca3 = fftshift(fft(s3));
[mzed{p]] sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
uE.BB# sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
u)<]Pb})r sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
JOuyEPy s3 = ifft(fftshift(sc3));
8?iI;( s2 = ifft(fftshift(sc2)); % Return to physical space
ah*{NR) s1 = ifft(fftshift(sc1));
_^W;J/He end
JlYZ\ p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
OjhX:{"59 p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
,]EhDW6 p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
yx Om=V P1=[P1 p1/p10];
nYSe0w P2=[P2 p2/p10];
=.z;:0]'n P3=[P3 p3/p10];
m%6VwV7U P=[P p*p];
A'#d:lOA end
"}v.>L<P figure(1)
0Fb];:a plot(P,P1, P,P2, P,P3);
Xr
<H^X 2VRGTx 转自:
http://blog.163.com/opto_wang/