计算脉冲在非线性耦合器中演化的Matlab 程序 {O[a+r.n b~z1%? % This Matlab script file solves the coupled nonlinear Schrodinger equations of
8 W79 % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
ULNU'6 % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
%[l5){:05 % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
vg5i+ry< W^Wr %fid=fopen('e21.dat','w');
ML9ZS
@ N = 128; % Number of Fourier modes (Time domain sampling points)
B~G?&"] M1 =3000; % Total number of space steps
:D""c* J =100; % Steps between output of space
!X*+Ct^ T =10; % length of time windows:T*T0
o+r?N5 T0=0.1; % input pulse width
_Y?p =; MN1=0; % initial value for the space output location
7o-umZ}8 dt = T/N; % time step
YAYPof~A$l n = [-N/2:1:N/2-1]'; % Index
R%=u<O t = n.*dt;
qH1[BsOx u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
]6bh #N;. u20=u10.*0.0; % input to waveguide 2
!?,7Cu.5#6 u1=u10; u2=u20;
ZEYT17g] U1 = u1;
Gb4k5jl U2 = u2; % Compute initial condition; save it in U
E3@G^Y ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
ycz6-kEp w=2*pi*n./T;
omevF>b; g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
N =FX3Z L=4; % length of evoluation to compare with S. Trillo's paper
P-o/ax dz=L/M1; % space step, make sure nonlinear<0.05
[+\=x[q for m1 = 1:1:M1 % Start space evolution
UzTFT:\ u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
j^-E,YMC u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
q$L=G ca1 = fftshift(fft(u1)); % Take Fourier transform
roSdcQTeT ca2 = fftshift(fft(u2));
DO`
K_B c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
">_<L.,I c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
S:aAR*<6 u2 = ifft(fftshift(c2)); % Return to physical space
I|8'#QX u1 = ifft(fftshift(c1));
1zqIB")s> if rem(m1,J) == 0 % Save output every J steps.
gG*]|>M JI U1 = [U1 u1]; % put solutions in U array
094~ s U2=[U2 u2];
h8B:}_Cu MN1=[MN1 m1];
AqnDsr! z1=dz*MN1'; % output location
/
VypN, end
(&t741DN| end
Fjch<gAofS hg=abs(U1').*abs(U1'); % for data write to excel
n,/eT,48` ha=[z1 hg]; % for data write to excel
=;Ap+} t1=[0 t'];
N1/)Fk-z hh=[t1' ha']; % for data write to excel file
.
7*k}@k %dlmwrite('aa',hh,'\t'); % save data in the excel format
@-ps[b`z figure(1)
B?n
6o|8 waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
&.^(,pt figure(2)
]z3!hgTj waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
@{/GdB,} mqe83 k% 非线性超快脉冲耦合的数值方法的Matlab程序 }.*"ezaZw 5^lFksZ 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
&BTgISYi 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
nYy%=B|> [.:SV|AF# oE/g)m% KTLq~Ru % This Matlab script file solves the nonlinear Schrodinger equations
B}S!l>.z % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
B\^myg4 % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
I
"Qf};n % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
LL% Aw)Q` p6S{OUiG C=1;
+\Uq=@ M1=120, % integer for amplitude
n92*:Y M3=5000; % integer for length of coupler
fL$U%I3 N = 512; % Number of Fourier modes (Time domain sampling points)
]]Bqte dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
R%Xhdcn7 T =40; % length of time:T*T0.
vX?MB dt = T/N; % time step
_EHz>DJ9 n = [-N/2:1:N/2-1]'; % Index
fG dT2}gd t = n.*dt;
\iL{q^Im ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
B|I9Ex~L w=2*pi*n./T;
M$J{clr g1=-i*ww./2;
Z01BzIsR g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
'0b!lVe g3=-i*ww./2;
t .\<Q#bN# P1=0;
mH`K~8pRg P2=0;
[pY1\$, P3=1;
srL|Y&8 p P=0;
4e`GMtp for m1=1:M1
r<MW8 p=0.032*m1; %input amplitude
yj$a0Rgkv s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
~W/|RP7S s1=s10;
OKo)p`BX s20=0.*s10; %input in waveguide 2
b?^CnMO s30=0.*s10; %input in waveguide 3
=`st1K s2=s20;
mv,p*0 s3=s30;
vQH6CB" p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
FH3^@@Y% %energy in waveguide 1
>PbB /-> p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
Ty&Ok* %energy in waveguide 2
#3~hF)u&/ p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
{u}d`%_.M %energy in waveguide 3
PP*',D3 for m3 = 1:1:M3 % Start space evolution
^QG;:.3v s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
XfZ^,'z s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
l@W1bS s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
aw\0\'} sca1 = fftshift(fft(s1)); % Take Fourier transform
WY& [%r sca2 = fftshift(fft(s2));
'G)UIjl sca3 = fftshift(fft(s3));
F=g+R~F sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
pLiGky sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
eo [eN. sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
Dve+ #H6N s3 = ifft(fftshift(sc3));
$-w&<U$E s2 = ifft(fftshift(sc2)); % Return to physical space
GbB:K2 s1 = ifft(fftshift(sc1));
XM#xxf* Y end
uN;]Fv@Z p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
mVsghDESJ) p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
b[/uSwvi p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
bC h P1=[P1 p1/p10];
-dyN
Ah?= P2=[P2 p2/p10];
FW@(MIH P3=[P3 p3/p10];
3;%dn\
D P=[P p*p];
Y=5}u&\ end
b+#A=Z+Pr figure(1)
)` z{T plot(P,P1, P,P2, P,P3);
$S'~UbmYU Dg=!d)\ 转自:
http://blog.163.com/opto_wang/