计算脉冲在非线性耦合器中演化的Matlab 程序 P6rL;_~e 4V5*6O9(u % This Matlab script file solves the coupled nonlinear Schrodinger equations of
NunT2JP. % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
F{Hy@7 % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
3{z }[@N % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
akoI LX~u nor`w,2VF %fid=fopen('e21.dat','w');
H]\H'r" N = 128; % Number of Fourier modes (Time domain sampling points)
j!pxG5% M1 =3000; % Total number of space steps
(?(ahtT4T J =100; % Steps between output of space
a*`J]{3G T =10; % length of time windows:T*T0
de[_T%A T0=0.1; % input pulse width
w:Vs$, MN1=0; % initial value for the space output location
ruVm8BO dt = T/N; % time step
O.!?O( n = [-N/2:1:N/2-1]'; % Index
7 m%|TwJN t = n.*dt;
U*t`hn-xs u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
'_8Vay~ u20=u10.*0.0; % input to waveguide 2
+8"H%#~ u1=u10; u2=u20;
;F5%X\t- U1 = u1;
Sw~<W%! ? U2 = u2; % Compute initial condition; save it in U
Q_S
fFsY ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
E#OKeMK w=2*pi*n./T;
5k @k g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
;(A'XA4
6N L=4; % length of evoluation to compare with S. Trillo's paper
BDA\9m^3 dz=L/M1; % space step, make sure nonlinear<0.05
k<y$[xV for m1 = 1:1:M1 % Start space evolution
~W4<M:R u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
R?k1)n u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
F-t-d1w6 ca1 = fftshift(fft(u1)); % Take Fourier transform
SU^/qF%8 ca2 = fftshift(fft(u2));
}-kb"\X%g c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
s_|wvOW)' c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
aG!!z> u2 = ifft(fftshift(c2)); % Return to physical space
;a|A1DmZ u1 = ifft(fftshift(c1));
;X>KP,/r$ if rem(m1,J) == 0 % Save output every J steps.
~![R\gps U1 = [U1 u1]; % put solutions in U array
Xc.~6nYp U2=[U2 u2];
I]h+24_S MN1=[MN1 m1];
zR:S.e< z1=dz*MN1'; % output location
[69aTl>/ end
Y,9("'bo end
>2$M~to"1 hg=abs(U1').*abs(U1'); % for data write to excel
&p*N8S8 ha=[z1 hg]; % for data write to excel
/[mCK3_ t1=[0 t'];
)pJzw-m" hh=[t1' ha']; % for data write to excel file
SU:Cm:$ %dlmwrite('aa',hh,'\t'); % save data in the excel format
<[*s%9)'9 figure(1)
#nnP.t m waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
=
hpX2/] figure(2)
-?ip ?[Z waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
(mycUU% ~k&b3-A} 非线性超快脉冲耦合的数值方法的Matlab程序 A%Ao yy4E SFuzH)+VO 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
3Vhm$y%Td 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
{It4=I)M _)ERi*}x8 ks!
G \<I -7lJ % This Matlab script file solves the nonlinear Schrodinger equations
4Hu.o 7 % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
#fwG~Q( % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
-Q,lUP % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
sI`Lsd'V b2z~C{l C=1;
'&\km~& M1=120, % integer for amplitude
z19y>j M3=5000; % integer for length of coupler
[!v:fj N = 512; % Number of Fourier modes (Time domain sampling points)
9nB:=`T9 dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
%Dy a- T =40; % length of time:T*T0.
6$IAm# dt = T/N; % time step
o rEo$e< n = [-N/2:1:N/2-1]'; % Index
H>VuUH| t = n.*dt;
N3E=t#n ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
hhwV)Z w=2*pi*n./T;
H4)){\ g1=-i*ww./2;
#T+%$q [: g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
hD;[}8qN{ g3=-i*ww./2;
m]V5}-?al P1=0;
2;A].5>l P2=0;
W"$'$h P3=1;
=3sBWDB[ P=0;
C8i}~x< for m1=1:M1
zK33.HY p=0.032*m1; %input amplitude
9NVe>\s_ s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
2@=JIMtc s1=s10;
WJ=^r@Sf s20=0.*s10; %input in waveguide 2
ZNzye1JSm s30=0.*s10; %input in waveguide 3
\4mw>8wA s2=s20;
#lNi\Lw+j s3=s30;
N[czraFBD} p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
8JGt|, %energy in waveguide 1
;/$zBr`' p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
P#6y %energy in waveguide 2
p9Ks=\yvL p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
S=2-<R %energy in waveguide 3
'a*tee ^RS for m3 = 1:1:M3 % Start space evolution
5PG%)xff* s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
T0v;8Ee s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
JhIgqW2 s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
$TWt[ sca1 = fftshift(fft(s1)); % Take Fourier transform
F.K7w sca2 = fftshift(fft(s2));
1)vdM(y3j sca3 = fftshift(fft(s3));
GYZzWN}U sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
,qyH B2v sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
q*,];j/>k sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
yX?& K}JI s3 = ifft(fftshift(sc3));
J6Cw1Pi s2 = ifft(fftshift(sc2)); % Return to physical space
$#1i@dI s1 = ifft(fftshift(sc1));
h0L*8P`t end
Ar N *9 p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
7$k[cL1 p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
]_@5LvI p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
$s$z"< P1=[P1 p1/p10];
V07e29w P2=[P2 p2/p10];
._Wm%'uX P3=[P3 p3/p10];
\XD&0inv P=[P p*p];
)k{zRq:d end
I HgYgn figure(1)
Q
>] v?4 plot(P,P1, P,P2, P,P3);
H0_hQ:K E$T)N U\ 转自:
http://blog.163.com/opto_wang/