计算脉冲在非线性耦合器中演化的Matlab 程序 @TKQ_7BcB -eSI"To L< % This Matlab script file solves the coupled nonlinear Schrodinger equations of
yyR@kOGga % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
YVHDk7s % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
(I`<; % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
suj}A }xrrHp %fid=fopen('e21.dat','w');
0A~f
^ N = 128; % Number of Fourier modes (Time domain sampling points)
:+DAzjwO< M1 =3000; % Total number of space steps
7Ph+Vs+h J =100; % Steps between output of space
zJ0'KHF}o T =10; % length of time windows:T*T0
mR{%f?B T0=0.1; % input pulse width
}=3W(1cu- MN1=0; % initial value for the space output location
gvZLW!={ dt = T/N; % time step
7f=9(Zj n = [-N/2:1:N/2-1]'; % Index
F0NNS!WP7^ t = n.*dt;
Q~*3Z4)j u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
K3UG6S\B u20=u10.*0.0; % input to waveguide 2
I^A01\p u1=u10; u2=u20;
,TO&KO1;& U1 = u1;
cmh/a~vYaY U2 = u2; % Compute initial condition; save it in U
6ud<B ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
gk6j5 $Y"< w=2*pi*n./T;
D+_PyK~jc g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
UE\@7 L=4; % length of evoluation to compare with S. Trillo's paper
%@M/)"k dz=L/M1; % space step, make sure nonlinear<0.05
RZE:WE;5 for m1 = 1:1:M1 % Start space evolution
TAYt: u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
&9] [~$ u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
7 -V_)FK2c ca1 = fftshift(fft(u1)); % Take Fourier transform
.Lu=16 ca2 = fftshift(fft(u2));
Mz{ Rh+gS c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
")M.p_b[Z= c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
zck |jhJ6 u2 = ifft(fftshift(c2)); % Return to physical space
Zk;;~ESOU u1 = ifft(fftshift(c1));
CM's6qhQnn if rem(m1,J) == 0 % Save output every J steps.
LRd,7P U1 = [U1 u1]; % put solutions in U array
TbU9
<mY U2=[U2 u2];
XY QUU0R MN1=[MN1 m1];
;1OTK6 z1=dz*MN1'; % output location
f&cG;Y
end
t@19a6:Co end
k~?}z.g( hg=abs(U1').*abs(U1'); % for data write to excel
|QgXSe7 ha=[z1 hg]; % for data write to excel
s*#|EdD6@ t1=[0 t'];
izWl5}+'B hh=[t1' ha']; % for data write to excel file
@%cJjZ5y %dlmwrite('aa',hh,'\t'); % save data in the excel format
N$,)vb< figure(1)
$ .Z2Rdlv( waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
x}>tX figure(2)
R+JI?/H waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
17Gdu[E m<f{7]fi5 非线性超快脉冲耦合的数值方法的Matlab程序 246lFxG. `Zi #rr|)L 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
=,]J"n8|v 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
1W!n"3#
]D-48o0
O}D8 CC-:dNb % This Matlab script file solves the nonlinear Schrodinger equations
^{K8uN7 % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
I~qiF%?d % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
imhq*f#A[ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
#f~a\}$I Y-c~"# C=1;
;VFr5.*x M1=120, % integer for amplitude
o%QQ7S3P M3=5000; % integer for length of coupler
yK7>^p}V N = 512; % Number of Fourier modes (Time domain sampling points)
.}<B*e=y dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
.M{[J]H`t T =40; % length of time:T*T0.
1DcarF dt = T/N; % time step
.-Lqo=o\ n = [-N/2:1:N/2-1]'; % Index
7h0'R k t = n.*dt;
-9*WQU9R ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
2!otVz!Mh w=2*pi*n./T;
$B?7u@>, g1=-i*ww./2;
>C}RZdO~ g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
N]<gHGj} g3=-i*ww./2;
ck~xj0 P1=0;
9|WWA%p P2=0;
S+y2eP G P3=1;
uRy6~' P=0;
e,*[5xQ for m1=1:M1
/a|NGh% p=0.032*m1; %input amplitude
=|%T E s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
.KsvRx s1=s10;
,7g;r_qwA s20=0.*s10; %input in waveguide 2
p,8Z{mLn s30=0.*s10; %input in waveguide 3
w1_Ux<RF s2=s20;
R,bcE4WR" s3=s30;
tp^'W7E p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
`x VA]GR4c %energy in waveguide 1
\veL 5 p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
B~#@fIL %energy in waveguide 2
W8NA. p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
(B-9M) %energy in waveguide 3
R4(8]oUW for m3 = 1:1:M3 % Start space evolution
[alXD_ s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
~m?~eJK#a s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
fdG.=7` s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
@ 1A_eF sca1 = fftshift(fft(s1)); % Take Fourier transform
(`+Z'Y sca2 = fftshift(fft(s2));
Vgn1I(Gj 4 sca3 = fftshift(fft(s3));
fO>~V1 sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
Z5[:Zf?h7J sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
[;AcV73 sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
[ d7]&i}*| s3 = ifft(fftshift(sc3));
6w;|-/:` s2 = ifft(fftshift(sc2)); % Return to physical space
9`{2 h$U s1 = ifft(fftshift(sc1));
*^Y0}?]qT end
QZox3LM1&. p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
`=DCX%Vw p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
T_[\(K`w! p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
odf^W
P1=[P1 p1/p10];
b1]_e'jj P2=[P2 p2/p10];
34Khg P3=[P3 p3/p10];
)>5k'1 P=[P p*p];
mm-UQ\h end
MwqT`;lb figure(1)
!gHWYWu)! plot(P,P1, P,P2, P,P3);
S5KYZ
W X",0VO 转自:
http://blog.163.com/opto_wang/