计算脉冲在非线性耦合器中演化的Matlab 程序 |fsm8t<~8 eOO+>%Z
% This Matlab script file solves the coupled nonlinear Schrodinger equations of
XaI;2fMGI % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
?dy~mob % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
{E9v`u\ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
E,G<_40 N?r>%4 %fid=fopen('e21.dat','w');
9
wa,k N = 128; % Number of Fourier modes (Time domain sampling points)
Q ~|R Z7G M1 =3000; % Total number of space steps
S*W;%J5 J =100; % Steps between output of space
jrJR1npB T =10; % length of time windows:T*T0
sPYX~G&T T0=0.1; % input pulse width
<zfe}0 MN1=0; % initial value for the space output location
Eyh|a.)- dt = T/N; % time step
@98;VWY\ n = [-N/2:1:N/2-1]'; % Index
}Ag|gF!_ t = n.*dt;
HB&
& u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
uK*|2U6t u20=u10.*0.0; % input to waveguide 2
/9ZcM]X B u1=u10; u2=u20;
X33v:9= U1 = u1;
S0w> hr U2 = u2; % Compute initial condition; save it in U
:Z`4j ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
iv%w!3# w=2*pi*n./T;
-/{af g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
)na&"bJ L=4; % length of evoluation to compare with S. Trillo's paper
rnhFqNT: dz=L/M1; % space step, make sure nonlinear<0.05
eMMx8E)B for m1 = 1:1:M1 % Start space evolution
=v-2@=NJ`K u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
*_hLD5K! u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
hq_~^/v\ ca1 = fftshift(fft(u1)); % Take Fourier transform
/lD?VE ca2 = fftshift(fft(u2));
)*1.eObhL c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
s"#]L44N c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
2hOPzv&B u2 = ifft(fftshift(c2)); % Return to physical space
e1 a*'T$z u1 = ifft(fftshift(c1));
tm)*2lH6 if rem(m1,J) == 0 % Save output every J steps.
_vYzF+ U1 = [U1 u1]; % put solutions in U array
D!FaE N U2=[U2 u2];
WR.x&m> MN1=[MN1 m1];
u}jrfKdE z1=dz*MN1'; % output location
SE `l(-tL end
Q7Ij4 end
H~9=&p[Q hg=abs(U1').*abs(U1'); % for data write to excel
T!^Mvat ha=[z1 hg]; % for data write to excel
k$[{n'\@ t1=[0 t'];
oh\,OW hh=[t1' ha']; % for data write to excel file
1kFjas`g %dlmwrite('aa',hh,'\t'); % save data in the excel format
YdOUv|tZC figure(1)
W"sr$K2m| waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
R{3CW^1 figure(2)
=HE
m) waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
,b'4CF l]5% 非线性超快脉冲耦合的数值方法的Matlab程序 :c4kBl%gJ 'U)8rR 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
U6{dI@|B 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
DX@}!6|T Yo2Trh olty4kGD$V @-6?i) % This Matlab script file solves the nonlinear Schrodinger equations
,IjdO(?TC % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
_Y-$}KwY! % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
c4|so= % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
\3^Pjx ,P@QxnQ C=1;
rSyaZ6# M1=120, % integer for amplitude
:kp0EiJ M3=5000; % integer for length of coupler
k>{-[X,/OV N = 512; % Number of Fourier modes (Time domain sampling points)
dF,DiRD dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
2LhE]O(_" T =40; % length of time:T*T0.
< l[`"0 dt = T/N; % time step
)BLmoJOf n = [-N/2:1:N/2-1]'; % Index
*Q/E~4AW|t t = n.*dt;
lG]GlgSs ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
7Po/_% w=2*pi*n./T;
<nA3Sd"QfV g1=-i*ww./2;
q3\!$IM. g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
M[,^KJ! g3=-i*ww./2;
f[@#7,2~M P1=0;
Yq;&F0paK P2=0;
{Gkn_h-^ P3=1;
% +8 P=0;
# U`&jBU for m1=1:M1
4TJ!jDkox p=0.032*m1; %input amplitude
eCL?mh K s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
@Z2/9K%1' s1=s10;
vs*I7< s20=0.*s10; %input in waveguide 2
7xDN.o*> s30=0.*s10; %input in waveguide 3
lt%-m@#/ s2=s20;
S ljZ~x,! s3=s30;
6QptKXu7 p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
m){&:Hs %energy in waveguide 1
Ph\F'xROe p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
[NR1d-Wg %energy in waveguide 2
w{ m#Yt p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
)`RZkCe %energy in waveguide 3
3mA/Nu_ for m3 = 1:1:M3 % Start space evolution
_6I >+9#C s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
"0Y&~q[= s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
<w11nB) s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
9oD#t~+F4 sca1 = fftshift(fft(s1)); % Take Fourier transform
;S=e%:zb sca2 = fftshift(fft(s2));
Y;PDZbK3 sca3 = fftshift(fft(s3));
faJ8zX sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
k`Y,KuBpM sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
]=pWZ~A sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
?(M\:`G' s3 = ifft(fftshift(sc3));
>,w P!;dh s2 = ifft(fftshift(sc2)); % Return to physical space
pb=HVjW< s1 = ifft(fftshift(sc1));
<v-92? end
A'(k
Yc p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
X)FQ%(H< p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
$pJ3xp& p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
m"1
? P1=[P1 p1/p10];
],#ZPUn P2=[P2 p2/p10];
ix+x3OCip P3=[P3 p3/p10];
E<P*QZ-C3 P=[P p*p];
l>33z_H^ end
xKisL=l6Y figure(1)
pe|\'<>i plot(P,P1, P,P2, P,P3);
zkvH=wL JG1LS$p^ 转自:
http://blog.163.com/opto_wang/