计算脉冲在非线性耦合器中演化的Matlab 程序
:+ Jt^
6 #y1Bx, % This Matlab script file solves the coupled nonlinear Schrodinger equations of
[Atc "X$ % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
u5Up&QE!>q % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
>2b`\Q*< % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
e[1>(l}Ss 7 [d? %fid=fopen('e21.dat','w');
^lj7( N = 128; % Number of Fourier modes (Time domain sampling points)
w^q7n M1 =3000; % Total number of space steps
B=n[)"5fBO J =100; % Steps between output of space
<*(^{a.O T =10; % length of time windows:T*T0
ST
Z]8cw T0=0.1; % input pulse width
#HAC*n MN1=0; % initial value for the space output location
Pbn!KX~F~ dt = T/N; % time step
UDEj[12S n = [-N/2:1:N/2-1]'; % Index
]Gv!M?: t = n.*dt;
h3!$r~T!a: u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
5o)Y$>T0 u20=u10.*0.0; % input to waveguide 2
m$wlflt u1=u10; u2=u20;
IP3E9z_L U1 = u1;
!GwL,)0@^ U2 = u2; % Compute initial condition; save it in U
SeEw.;Xw ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
}Fa%%} w=2*pi*n./T;
,Na^%A@TJ g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
8wK ~
i L=4; % length of evoluation to compare with S. Trillo's paper
S6xgiem dz=L/M1; % space step, make sure nonlinear<0.05
?o*I9[Z) for m1 = 1:1:M1 % Start space evolution
PuL<^aJ u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
;H'gT+t<c u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
J2VTo: In ca1 = fftshift(fft(u1)); % Take Fourier transform
xQ4%e[/ ca2 = fftshift(fft(u2));
o!c]
( c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
;*2>ES c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
x/
*-P
b-_ u2 = ifft(fftshift(c2)); % Return to physical space
x =q;O+7] u1 = ifft(fftshift(c1));
?r=jF)C<' if rem(m1,J) == 0 % Save output every J steps.
O|kOI?f U1 = [U1 u1]; % put solutions in U array
CGbwmPx U2=[U2 u2];
2]cRXJ7h MN1=[MN1 m1];
_S}A=hK' z1=dz*MN1'; % output location
4_/?:$KO end
/Ncm^b4 end
c; 2#,m^ hg=abs(U1').*abs(U1'); % for data write to excel
Wb}c=hZv ha=[z1 hg]; % for data write to excel
zfA
GtT< t1=[0 t'];
z4X}O
{
hh=[t1' ha']; % for data write to excel file
k,yZ[n|` %dlmwrite('aa',hh,'\t'); % save data in the excel format
l{j~Q^U}) figure(1)
v'!a\b`9 waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
Ho;X4lo[j figure(2)
PwB1]p= waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
t. ='/`!N 7!WA)@6 非线性超快脉冲耦合的数值方法的Matlab程序 v59dh (:`Z )3Z ^h<"j 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
{X(:jAy 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
~*A8+@\R :a
->0 l aFz5leD q@t0NvNSu % This Matlab script file solves the nonlinear Schrodinger equations
H,nec<Jp % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
hCjR&ZA % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
i.D3'l % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
,I1RV npJt3
Y_I C=1;
eIRLNxt+v M1=120, % integer for amplitude
.sC?7O= M3=5000; % integer for length of coupler
/+Lfrt N = 512; % Number of Fourier modes (Time domain sampling points)
bef_rH@` dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
m< _S_c T =40; % length of time:T*T0.
8>,jpAN}r dt = T/N; % time step
(bsXo
q n = [-N/2:1:N/2-1]'; % Index
ks$JP6 t = n.*dt;
ho##Z*O ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
+gtrt^:]l w=2*pi*n./T;
),G= s Oo g1=-i*ww./2;
X/iT)R]b g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
g35DV6 g3=-i*ww./2;
M`rl!Ci# P1=0;
%?e& WLS P2=0;
\b%kf9 9 P3=1;
fFb_J`'ue P=0;
8"sb; for m1=1:M1
z!l.:F p=0.032*m1; %input amplitude
Vn*tpbz s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
yW$0\E6<r s1=s10;
,lZB96r0 s20=0.*s10; %input in waveguide 2
j@YU|-\qh s30=0.*s10; %input in waveguide 3
yE}}c{hSn s2=s20;
GB$;n? s3=s30;
\"X!2 p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
(h>-&.`& %energy in waveguide 1
(p2K36,9m p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
bbrXgQ`s+w %energy in waveguide 2
vI>>\.ED p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
-r-k_6QP %energy in waveguide 3
{NHdyc$ for m3 = 1:1:M3 % Start space evolution
|&RU/ a s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
rg^'S1x| s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
`DV.+>O-1 s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
<YdE1{fm sca1 = fftshift(fft(s1)); % Take Fourier transform
8_{X1bj sca2 = fftshift(fft(s2));
/Mvf8v sca3 = fftshift(fft(s3));
0u;4%}pD sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
a!=D [Gz*5 sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
.&DhN#EN0 sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
rJGf.qJJ s3 = ifft(fftshift(sc3));
KET2Ws[w s2 = ifft(fftshift(sc2)); % Return to physical space
\O2Rhz s1 = ifft(fftshift(sc1));
Mu+0<> end
'.:z&gSqx0 p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
vEJWFoeEFm p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
uScMn/% p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
a{L
d P1=[P1 p1/p10];
I}1NB3>^ P2=[P2 p2/p10];
#qK:J;Sn3 P3=[P3 p3/p10];
G3Z)Z)N P=[P p*p];
&5yVxL: end
A~)D[CV figure(1)
lhy*h_> plot(P,P1, P,P2, P,P3);
U|jSa,} hb}+A=A=+ 转自:
http://blog.163.com/opto_wang/