计算脉冲在非线性耦合器中演化的Matlab 程序 `_e 1LEH [k
+fkr] % This Matlab script file solves the coupled nonlinear Schrodinger equations of
U}`HN*Q.q % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
@h\u}Ee % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
mK7egAo % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
l< |)LDq~ _Ai\XS
Am %fid=fopen('e21.dat','w');
_1Iw"K49Qx N = 128; % Number of Fourier modes (Time domain sampling points)
0j~C6vp M1 =3000; % Total number of space steps
wvSaq+N J =100; % Steps between output of space
s2+s1%^Ll T =10; % length of time windows:T*T0
G5 x%:,n T0=0.1; % input pulse width
cbA90 8@s MN1=0; % initial value for the space output location
^$O,Gy) V dt = T/N; % time step
\\Huk*Jn{ n = [-N/2:1:N/2-1]'; % Index
OGO4~Up t = n.*dt;
&@D,|kHk u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
n|iO)L\9aB u20=u10.*0.0; % input to waveguide 2
r(qU~re'
u1=u10; u2=u20;
#$>m`r U1 = u1;
Qjh @oWT U2 = u2; % Compute initial condition; save it in U
RnkrI~x ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
('p~h-9Vi w=2*pi*n./T;
SfwAMNCe g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
cz9T, L=4; % length of evoluation to compare with S. Trillo's paper
?g'? Ou dz=L/M1; % space step, make sure nonlinear<0.05
RV:%^=V- for m1 = 1:1:M1 % Start space evolution
|q\:3R_0 u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
djcCm5m u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
UYb:q ca1 = fftshift(fft(u1)); % Take Fourier transform
Hlq#X:DCn ca2 = fftshift(fft(u2));
viY &D c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
[&
&9F}; c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
f?A*g$v u2 = ifft(fftshift(c2)); % Return to physical space
"h}miVArS u1 = ifft(fftshift(c1));
{)0"?$C_H if rem(m1,J) == 0 % Save output every J steps.
j!P]xl0vOZ U1 = [U1 u1]; % put solutions in U array
/g!', r, U2=[U2 u2];
t/aT MN1=[MN1 m1];
<Cw)S8t z1=dz*MN1'; % output location
$/Q*@4t
end
%<8lLRl end
3Ga!) hg=abs(U1').*abs(U1'); % for data write to excel
TM|ycS' ha=[z1 hg]; % for data write to excel
8?O6IDeW t1=[0 t'];
7,2bR hh=[t1' ha']; % for data write to excel file
.pOTIRbA %dlmwrite('aa',hh,'\t'); % save data in the excel format
_ZfJfd~ figure(1)
y++[:M waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
Og`w ~!\ figure(2)
7x^P 74 waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
um[nz N?h=Zl| 非线性超快脉冲耦合的数值方法的Matlab程序 #yk
m TnqspS2;R 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
C<\|4ERp 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
'lym^^MjL+ w#5^A(NR G~I@'[ur qqSf17sW % This Matlab script file solves the nonlinear Schrodinger equations
!;^sIoRPV % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
/JfRy%31 % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
c?{&=,u2 % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
H1>}E5^? mRw &^7r C=1;
T^ ^o M1=120, % integer for amplitude
:U>o; M3=5000; % integer for length of coupler
jLf. qf8qm N = 512; % Number of Fourier modes (Time domain sampling points)
dw8Ce8W dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
hSq3LoHV T =40; % length of time:T*T0.
&oTUj'$ dt = T/N; % time step
%W=S*"e- n = [-N/2:1:N/2-1]'; % Index
!52]'yub t = n.*dt;
8=H!&+aGh ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
gh3XC.& w=2*pi*n./T;
Tt.wY=,K g1=-i*ww./2;
hGx)X64Mw g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
"]81+
D g3=-i*ww./2;
SXn1v.6 P1=0;
PYYOC"$ P2=0;
_
a|zvH P3=1;
t/\J P=0;
N246RV1W for m1=1:M1
@JS O=8 p=0.032*m1; %input amplitude
lz?F ,]. s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
J)iy6{0" s1=s10;
C#`VVtei s20=0.*s10; %input in waveguide 2
NuKktQd s30=0.*s10; %input in waveguide 3
K%ltB& s2=s20;
, [xDNl[Y| s3=s30;
-9)<[>: p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
_6"!y
]Q %energy in waveguide 1
j_VTa/ p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
|T~C($9 %energy in waveguide 2
gN|[n.W4 p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
;#G)([ %energy in waveguide 3
SyFOf for m3 = 1:1:M3 % Start space evolution
Bkvh]k;F8 s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
q$Z.5EN s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
u;m[, s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
GU\}}j] sca1 = fftshift(fft(s1)); % Take Fourier transform
3zU!5tg sca2 = fftshift(fft(s2));
<J4|FOz!= sca3 = fftshift(fft(s3));
8|uFW7Q sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
8_6\>hW& sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
s)ymm7? sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
=^m,|j|d>4 s3 = ifft(fftshift(sc3));
c0.i s2 = ifft(fftshift(sc2)); % Return to physical space
01VEz
8[\ s1 = ifft(fftshift(sc1));
Mvq5s +. end
^| L@f p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
6vySOVMj p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
*6oQW p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
3A'vq2beM P1=[P1 p1/p10];
'`$z!rA P2=[P2 p2/p10];
X(nbfh?n P3=[P3 p3/p10];
7yGc@kJ? P=[P p*p];
N6Mo| end
Z<6XB{Nh\ figure(1)
?z>7& plot(P,P1, P,P2, P,P3);
Zi5d"V[}T ;v0M
:: 转自:
http://blog.163.com/opto_wang/