计算脉冲在非线性耦合器中演化的Matlab 程序 $Tur"_`I; OXacI~C % This Matlab script file solves the coupled nonlinear Schrodinger equations of
(;j7{( % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
UA8!?r-cR % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
>Qx#2x+ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
4By-+C* 0/gcSW
b %fid=fopen('e21.dat','w');
I coL/7k3 N = 128; % Number of Fourier modes (Time domain sampling points)
d$TW](Bby M1 =3000; % Total number of space steps
p_AV3 J =100; % Steps between output of space
F:@Ixk?E T =10; % length of time windows:T*T0
Na6z,TW T0=0.1; % input pulse width
*@&
"MZ/M MN1=0; % initial value for the space output location
1%@~J\qF dt = T/N; % time step
)mPlB. n = [-N/2:1:N/2-1]'; % Index
bvx:R ~E$ t = n.*dt;
`@eH4}L* u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
l =yHx\ u20=u10.*0.0; % input to waveguide 2
qC4-J)8Wk u1=u10; u2=u20;
_)l %-*Z7p U1 = u1;
"P{&UwMmh U2 = u2; % Compute initial condition; save it in U
=R'v]SXj ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
19.cf3Dh w=2*pi*n./T;
:z\f.+MI g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
?},ItJ#>)q L=4; % length of evoluation to compare with S. Trillo's paper
1;P\mff3Y dz=L/M1; % space step, make sure nonlinear<0.05
Ax0,7,8y for m1 = 1:1:M1 % Start space evolution
(6BCFl:/Q< u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
+o u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
ifs*-f ca1 = fftshift(fft(u1)); % Take Fourier transform
]p!J]YV ]0 ca2 = fftshift(fft(u2));
! -c*lb c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
Y2X1!Em>B c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
Du>HF;Fv u2 = ifft(fftshift(c2)); % Return to physical space
(OqJet2{+ u1 = ifft(fftshift(c1));
>.iw8#l if rem(m1,J) == 0 % Save output every J steps.
1955(:I U1 = [U1 u1]; % put solutions in U array
HUC2RM?FN U2=[U2 u2];
{K9E% ,w MN1=[MN1 m1];
<yS"c5D6 z1=dz*MN1'; % output location
[!&k?.*;< end
z\tJ~ end
\Wc/kY3& hg=abs(U1').*abs(U1'); % for data write to excel
Y*k<NeDyn ha=[z1 hg]; % for data write to excel
OQ7c|O t1=[0 t'];
uB1!*S1f hh=[t1' ha']; % for data write to excel file
?i~/gjp
%dlmwrite('aa',hh,'\t'); % save data in the excel format
Y/0O9}hf figure(1)
Fw9``{4w waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
wP/9z(US figure(2)
4QFOO
sNp waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
ku;nVV H040-Q;S' 非线性超快脉冲耦合的数值方法的Matlab程序 ? ~Zrd ?Q)Z..7 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
AfN 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
({KAh? z4641q5'm ~Ls I<z {,FeNf46 % This Matlab script file solves the nonlinear Schrodinger equations
[T]qm7
? % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
WWcm(q= % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
[\9(@Bx % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
eH955[fVd4 %"Q!5qH& C=1;
.p9h$z^ M1=120, % integer for amplitude
F[=lA"F^ M3=5000; % integer for length of coupler
/JeqoM"x N = 512; % Number of Fourier modes (Time domain sampling points)
a{HgIQg_>R dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
j{R|]SjW2H T =40; % length of time:T*T0.
THgzT\_zq dt = T/N; % time step
.eNwC .8i n = [-N/2:1:N/2-1]'; % Index
8.Ef 5-m t = n.*dt;
HoE.//b ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
kQd[E-b7 w=2*pi*n./T;
&NjZD4m`= g1=-i*ww./2;
8ex:OTzn| g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
Y"kS!!C>[ g3=-i*ww./2;
P .4b+9Tx P1=0;
"!Oh#Vf P2=0;
{2k<
k(, P3=1;
%4|}&,%%r P=0;
D2:a for m1=1:M1
V1nZ M p=0.032*m1; %input amplitude
1+tt' s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
}0*ra37z> s1=s10;
C.)&FW2F_ s20=0.*s10; %input in waveguide 2
X,EYa>RSy_ s30=0.*s10; %input in waveguide 3
dh;Mp E s2=s20;
wu!_BCIy s3=s30;
H.8CwsfP p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
p5;,/
|Ft %energy in waveguide 1
cvV?V\1f p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
a]Da`$T %energy in waveguide 2
zg Y*|{4Sl p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
0/P-> n~ %energy in waveguide 3
bC4*w
O for m3 = 1:1:M3 % Start space evolution
f93rY< s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
0tm_}L$g=b s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
AzO3 (1: s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
]7S7CVDk4 sca1 = fftshift(fft(s1)); % Take Fourier transform
>)J47j7{c sca2 = fftshift(fft(s2));
xDA,?i;T
0 sca3 = fftshift(fft(s3));
W[X!P)=w] sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
7! b)'W? sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
wy_;+ 'Y sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
?sf2h:\N s3 = ifft(fftshift(sc3));
TQ\wHJ s2 = ifft(fftshift(sc2)); % Return to physical space
:KV,:13`D s1 = ifft(fftshift(sc1));
F `pyhc>1; end
BRU9LS p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
b8{h[YJL2 p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
l`FR.)2h p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
9Ajgfy> P1=[P1 p1/p10];
v>y8s&/ P2=[P2 p2/p10];
@@{_[ir P3=[P3 p3/p10];
;TV'PJ P=[P p*p];
9HNh*Gc= end
ghobu}wuF figure(1)
!/Bw,y ri< plot(P,P1, P,P2, P,P3);
(m3I#L wO_pcNYZ8 转自:
http://blog.163.com/opto_wang/