计算脉冲在非线性耦合器中演化的Matlab 程序 DG
$._ KU}HVM{ % This Matlab script file solves the coupled nonlinear Schrodinger equations of
$@blP<I % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
(iZE}qf7g % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
^v].mV/ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
4SqZV 6hs2B5)+ %fid=fopen('e21.dat','w');
zu
Jl #3YP N = 128; % Number of Fourier modes (Time domain sampling points)
=7c1l77z M1 =3000; % Total number of space steps
_,M:"3;Z J =100; % Steps between output of space
iEf6oM T =10; % length of time windows:T*T0
wGC)gW T0=0.1; % input pulse width
F+@E6I'g MN1=0; % initial value for the space output location
OgTE^W@ dt = T/N; % time step
vZns,K#4H\ n = [-N/2:1:N/2-1]'; % Index
g(0
|p6R t = n.*dt;
-\`n{$OR u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
Y+#e| x u20=u10.*0.0; % input to waveguide 2
`[;b#. u1=u10; u2=u20;
Svmyg] U1 = u1;
i cf[.
U2 = u2; % Compute initial condition; save it in U
ReCmv/AE ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
Hop$w w=2*pi*n./T;
EMe6Z!k g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
a9q68 L=4; % length of evoluation to compare with S. Trillo's paper
!$>d75zli dz=L/M1; % space step, make sure nonlinear<0.05
nJ|8#U7 for m1 = 1:1:M1 % Start space evolution
ul e]eRAG u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
F`ifHO u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
6SMGXy*]^ ca1 = fftshift(fft(u1)); % Take Fourier transform
}Vpr7_ ca2 = fftshift(fft(u2));
u|=G#y;3 c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
Oifu ?f<r c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
/AR;O4X+ u2 = ifft(fftshift(c2)); % Return to physical space
KsGS s9 u1 = ifft(fftshift(c1));
22|f!la8n if rem(m1,J) == 0 % Save output every J steps.
gkuI!= U1 = [U1 u1]; % put solutions in U array
b\%=mN U2=[U2 u2];
g]V}azLr MN1=[MN1 m1];
D4m2*%M z1=dz*MN1'; % output location
S#X$QD end
~4wbIE_rN end
'A,&9E{%1 hg=abs(U1').*abs(U1'); % for data write to excel
sa`7_KB ha=[z1 hg]; % for data write to excel
}`$:3mb&f t1=[0 t'];
,sk;|OAI hh=[t1' ha']; % for data write to excel file
!+.|T9P %dlmwrite('aa',hh,'\t'); % save data in the excel format
'f<0&Ci8 figure(1)
W Io^=?% waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
:YB:)wV,P figure(2)
_VR Sdr5 waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
]do0{I%\eq B7TA:K
非线性超快脉冲耦合的数值方法的Matlab程序 _y)#N< I<.3"F1} 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
2|o6~m<pE 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
w?.0r6j !>/U6h,_ qyc:;3?wm uG3t%CmN % This Matlab script file solves the nonlinear Schrodinger equations
w&v_#\T % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
f&(u[W % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
b^PYA_k-Xn % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
PDX^MYoN Nm<3bd C=1;
q+t*3;X. M1=120, % integer for amplitude
/Z>#lMg\. M3=5000; % integer for length of coupler
T"t3e=xA N = 512; % Number of Fourier modes (Time domain sampling points)
6@!<'l%z dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
_U$d.B'*)z T =40; % length of time:T*T0.
[e ;K$ dt = T/N; % time step
PBr-<J n = [-N/2:1:N/2-1]'; % Index
-zHJ# t = n.*dt;
K|Std)6 ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
GfY!~J w=2*pi*n./T;
5_M9 T3 g1=-i*ww./2;
V_!hrKkL g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
]BCH9%zLj g3=-i*ww./2;
g`gH]W
FcG P1=0;
DI**fywu[3 P2=0;
Yv9(8 P3=1;
hti)<#f P=0;
%|o4 U0c for m1=1:M1
6ndt1W
z p=0.032*m1; %input amplitude
zF(I#|Vo s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
2#ha Icm" s1=s10;
d/- f] s20=0.*s10; %input in waveguide 2
2M=
gpy s30=0.*s10; %input in waveguide 3
,;H)CUe1" s2=s20;
w^NE`4 - s3=s30;
sBq @W4 p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
$PstThM %energy in waveguide 1
LwkZ (Tt
p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
4'?kyTO~ %energy in waveguide 2
e0+N1kY p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
Am!$\T%2 %energy in waveguide 3
!u~( \Rb; for m3 = 1:1:M3 % Start space evolution
z`xdRe{QP s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
[st4FaQ36 s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
(5;w^E9*n; s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
Wze\z
sca1 = fftshift(fft(s1)); % Take Fourier transform
>Rjk d>K3 sca2 = fftshift(fft(s2));
jUZ84Gm{ sca3 = fftshift(fft(s3));
4iRcmsP sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
]gHw;ry sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
&voyEvX/S sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
lycY1 lK s3 = ifft(fftshift(sc3));
5)2lZ(5.A# s2 = ifft(fftshift(sc2)); % Return to physical space
PE|_V s1 = ifft(fftshift(sc1));
:|M0n%-X end
}9aYU;9D p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
Q~#udEajI p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
&2Q4{i p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
HzF P1=[P1 p1/p10];
7P?z{x':T P2=[P2 p2/p10];
{b"V7vn, P3=[P3 p3/p10];
!BP/# P=[P p*p];
8U*}D~%! end
|(*ReQ?= figure(1)
F# y5T3(P plot(P,P1, P,P2, P,P3);
V?t^ J7{' tVvRT*>Wb 转自:
http://blog.163.com/opto_wang/