计算脉冲在非线性耦合器中演化的Matlab 程序 Ea?.HRxl #J_i 5KmXJ % This Matlab script file solves the coupled nonlinear Schrodinger equations of
*_wBV
M=2 % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
67?5Cv % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
566Qikw2 % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
v'tk:Hm1 |#6Lcz7[ %fid=fopen('e21.dat','w');
z^.0eP8\j N = 128; % Number of Fourier modes (Time domain sampling points)
s=4.Ovd\ M1 =3000; % Total number of space steps
CgC wM=!r J =100; % Steps between output of space
|sz9l/,lG T =10; % length of time windows:T*T0
|{T2|iJI T0=0.1; % input pulse width
8vK&d> MN1=0; % initial value for the space output location
k7*q.2 0 dt = T/N; % time step
bSfQH4F n = [-N/2:1:N/2-1]'; % Index
5FxU=M1gF t = n.*dt;
\ 714 Pyy u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
at!?"u u20=u10.*0.0; % input to waveguide 2
3
6
;hg# u1=u10; u2=u20;
-wB AFr U1 = u1;
"T|\ U2 = u2; % Compute initial condition; save it in U
9&cZIP ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
\BL9}5y w=2*pi*n./T;
<=Qk^Y2k g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
jxvVp*-=<j L=4; % length of evoluation to compare with S. Trillo's paper
5oS\uX| dz=L/M1; % space step, make sure nonlinear<0.05
eAMT7 2_ for m1 = 1:1:M1 % Start space evolution
32yNEP{ u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
"|if<hx+ u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
KXJHb{? ca1 = fftshift(fft(u1)); % Take Fourier transform
kN)ev?pQ[ ca2 = fftshift(fft(u2));
(&(f`c@I c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
JFZ p^{ c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
i weP3u## u2 = ifft(fftshift(c2)); % Return to physical space
0*)79Sz u1 = ifft(fftshift(c1));
fvDwg if rem(m1,J) == 0 % Save output every J steps.
rzu^br9X U1 = [U1 u1]; % put solutions in U array
T (qu~} U2=[U2 u2];
9!LAAE` MN1=[MN1 m1];
\IKr+wlN8 z1=dz*MN1'; % output location
7F.,Xvw&@ end
:"4~VDu end
kbY@Y,:w hg=abs(U1').*abs(U1'); % for data write to excel
VZ8L9h<{" ha=[z1 hg]; % for data write to excel
jkq+j^ t1=[0 t'];
$dR%8@.H hh=[t1' ha']; % for data write to excel file
9L};vkYk# %dlmwrite('aa',hh,'\t'); % save data in the excel format
k;sUD mrO figure(1)
YdFC YSiS waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
{8' 5 figure(2)
-LyIu# waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
{-xnBx GOt@x9% 非线性超快脉冲耦合的数值方法的Matlab程序 nV,a|V5Xm (I$hw"%& 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
F<$&G'% H 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
V+^\SiM $[Fk>d =["GnL*!0 y;;@T X % This Matlab script file solves the nonlinear Schrodinger equations
L|<Mtw % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
Oe$C5KA>LW % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
STI8[e7{ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
%^S1 fUwT LE;c+(CAU C=1;
,0~=9dR M1=120, % integer for amplitude
W;=ZQ5Lw M3=5000; % integer for length of coupler
(~jOtUyT N = 512; % Number of Fourier modes (Time domain sampling points)
Z1Wra-g dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
1n^xVk-G T =40; % length of time:T*T0.
V|7 cdX#H dt = T/N; % time step
FW2} 9#R n = [-N/2:1:N/2-1]'; % Index
KLX>QR@ t = n.*dt;
s[hD9$VB> ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
;/v^@ w=2*pi*n./T;
m\(a{x g1=-i*ww./2;
TtzB[F g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
kW"N~Xw) g3=-i*ww./2;
,D8Tca\v P1=0;
#u~8Txt P2=0;
'>Z
Ou3> P3=1;
%EuSP0 P=0;
~Y{K^:wN^ for m1=1:M1
uB\A8zC p=0.032*m1; %input amplitude
Ae"B]Cxb_X s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
PH6uP] s1=s10;
y0xte& s20=0.*s10; %input in waveguide 2
8qT/1b s30=0.*s10; %input in waveguide 3
j:0z/gHp$ s2=s20;
}u
:sh >2 s3=s30;
{J[0UZ6 p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
*p"%cas %energy in waveguide 1
37VSE@Z+ p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
Z',pQ{rD %energy in waveguide 2
K#>B'>A\ p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
d2pVO]l YZ %energy in waveguide 3
.mMM]*e[0 for m3 = 1:1:M3 % Start space evolution
L!\I>a5C0G s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
8{AzB8xp s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
).\%a
h s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
RJ`F2b sYN sca1 = fftshift(fft(s1)); % Take Fourier transform
"_lSw3 sca2 = fftshift(fft(s2));
Kg56.$ sca3 = fftshift(fft(s3));
4g|}]K1s sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
0y?bwxkc sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
YQ]W<0( sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
\j4TDCs_[ s3 = ifft(fftshift(sc3));
&U:;jlST9 s2 = ifft(fftshift(sc2)); % Return to physical space
/)j:Y:5 s1 = ifft(fftshift(sc1));
LKhUqW end
T{Av[>M p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
W_%Dg]l
p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
Gx!Y
4Q}- p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
XLB7
E P1=[P1 p1/p10];
0y*8;7-|r) P2=[P2 p2/p10];
8RB\P:6h P3=[P3 p3/p10];
"5=Gu1 P=[P p*p];
d4~!d>{n|c end
/>H9T[3= figure(1)
_G@)Bj^* plot(P,P1, P,P2, P,P3);
*5u0`k^j /@:I\&{f'9 转自:
http://blog.163.com/opto_wang/