计算脉冲在非线性耦合器中演化的Matlab 程序 W>${zVu H9'$C/w % This Matlab script file solves the coupled nonlinear Schrodinger equations of
I:=S0&%) % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
M1k{t%M+S % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
1h^:[[!c % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
4GkWRu1 {j{u6i %fid=fopen('e21.dat','w');
)1]ZtU N = 128; % Number of Fourier modes (Time domain sampling points)
%"q9:{m M1 =3000; % Total number of space steps
VpE*(i$ J =100; % Steps between output of space
JgxtlYjl T =10; % length of time windows:T*T0
R|6Cv3: T0=0.1; % input pulse width
,1y@Z 5wy MN1=0; % initial value for the space output location
1auIR/=- dt = T/N; % time step
8V~k5#&Ow n = [-N/2:1:N/2-1]'; % Index
Lm iOhx t = n.*dt;
35h8O,Y u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
[8Y:65 u20=u10.*0.0; % input to waveguide 2
MU($|hwiL u1=u10; u2=u20;
`xKp%9 U1 = u1;
BOX{]EOj U2 = u2; % Compute initial condition; save it in U
'f#{{KA ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
hwPw]Ln/ w=2*pi*n./T;
d?y4GkK g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
4)S,3G L=4; % length of evoluation to compare with S. Trillo's paper
Jf{*PgP dz=L/M1; % space step, make sure nonlinear<0.05
Lz
|?ek7Q for m1 = 1:1:M1 % Start space evolution
1jx:;j u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
h\$$JeSV] u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
j@AIK+0Qc ca1 = fftshift(fft(u1)); % Take Fourier transform
YDIG,%uv ca2 = fftshift(fft(u2));
2bv=N4ly c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
Z-$[\le c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
)%`c_FL@N= u2 = ifft(fftshift(c2)); % Return to physical space
+vw\y u1 = ifft(fftshift(c1));
uF X#`^r` if rem(m1,J) == 0 % Save output every J steps.
{dhXIs U1 = [U1 u1]; % put solutions in U array
=Z{O<xw' U2=[U2 u2];
y8d]9sX{ MN1=[MN1 m1];
^-TE([ bW z1=dz*MN1'; % output location
r7RIRg_ end
;@0;pY end
/}((l%U E. hg=abs(U1').*abs(U1'); % for data write to excel
E:,/!9n ha=[z1 hg]; % for data write to excel
J-[,KME_^ t1=[0 t'];
kGH }[w hh=[t1' ha']; % for data write to excel file
]vz%iv_ %dlmwrite('aa',hh,'\t'); % save data in the excel format
,cXD.y figure(1)
ADz ^\ waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
Z|&MKG24 figure(2)
ML}J\7R waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
M f}~{+ 272q1~& 非线性超快脉冲耦合的数值方法的Matlab程序 9)D6Nm B+$%*%b 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
'@a}H9>} 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
-{KQr1{5UM Bm:98? [ ,[N%Q# i"1Mfz~e % This Matlab script file solves the nonlinear Schrodinger equations
-m\u % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
raW>xOivR % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
J9..P&c\ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
^8]NxV@l 5A,K6f@:g C=1;
el&0}`K M1=120, % integer for amplitude
l?\jB\, M3=5000; % integer for length of coupler
>d(~#Z` N = 512; % Number of Fourier modes (Time domain sampling points)
2pZXZ dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
D+#E-8 T =40; % length of time:T*T0.
3Lfqdqj dt = T/N; % time step
%7QV&[4! n = [-N/2:1:N/2-1]'; % Index
V~UN t = n.*dt;
~]nRV *^ ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
,D5cjaX< w=2*pi*n./T;
`b?R#:G g1=-i*ww./2;
EHSlK5bD, g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
DMs,y{v g3=-i*ww./2;
Oylf<&knF\ P1=0;
Cw~q4A6' P2=0;
a y4 % P3=1;
:vYYfs& P=0;
W}nlRbN? for m1=1:M1
$&Gu)4'+ p=0.032*m1; %input amplitude
t Cw<Ip s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
O8f?; ] s1=s10;
dR
K?~1 s20=0.*s10; %input in waveguide 2
CVDV)#JA s30=0.*s10; %input in waveguide 3
r^2p*nr} s2=s20;
bs+f,j-oBN s3=s30;
MO[2~`,Q! p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
HUcq%. %energy in waveguide 1
!d'GE`w T p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
\h+AXs<j %energy in waveguide 2
)tG\vk=@ p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
+|*IZ:w) %energy in waveguide 3
8aZ=?_gvT for m3 = 1:1:M3 % Start space evolution
nz%DM<0$ s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
G%BjhpL s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
;$HftG>B s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
3Nl <p"= sca1 = fftshift(fft(s1)); % Take Fourier transform
QZ!Y2Bz(4 sca2 = fftshift(fft(s2));
1eA7>$w}[ sca3 = fftshift(fft(s3));
6d:zb;Iz sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
>3ZFzh&OYQ sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
7 G)ZN{' sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
p}jE s3 = ifft(fftshift(sc3));
eFipIn)b s2 = ifft(fftshift(sc2)); % Return to physical space
S&e0u%8mc s1 = ifft(fftshift(sc1));
a,Sw4yJ!Q end
\-L&5x"x p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
.GbX]?dN p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
[m+2(I1 p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
\1d( 9jR P1=[P1 p1/p10];
6e (Qwt P2=[P2 p2/p10];
Cmu@4j& P3=[P3 p3/p10];
ih)zG P=[P p*p];
[<7@{;r end
>u>5{4 figure(1)
j 7fL7:,T plot(P,P1, P,P2, P,P3);
;
a/X< w2Us!<x 转自:
http://blog.163.com/opto_wang/