计算脉冲在非线性耦合器中演化的Matlab 程序 TmI~P+5w `M0m`Up % This Matlab script file solves the coupled nonlinear Schrodinger equations of
cJ[gCS % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
h-)tWJ c % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
WI@l2`X % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
v|DgRPY ft |W %fid=fopen('e21.dat','w');
nPlg5&E N = 128; % Number of Fourier modes (Time domain sampling points)
Y3%_IwSJ| M1 =3000; % Total number of space steps
Jz"Yb
J =100; % Steps between output of space
1 Hw %DJ T =10; % length of time windows:T*T0
0?@;zTE0 T0=0.1; % input pulse width
B?bdHO:E~ MN1=0; % initial value for the space output location
D==C"}J dt = T/N; % time step
lX g.` n = [-N/2:1:N/2-1]'; % Index
-8Z;s8ACo t = n.*dt;
>;wh0dBe u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
e`]x?t<U4/ u20=u10.*0.0; % input to waveguide 2
pZeJ$3@vk u1=u10; u2=u20;
[S Jx\Os U1 = u1;
Y52f8qQq U2 = u2; % Compute initial condition; save it in U
94uAt&&b( ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
}
O:Y?Wq^ w=2*pi*n./T;
EV=/'f[++ g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
JU>F&g/| L=4; % length of evoluation to compare with S. Trillo's paper
l~",<bTc dz=L/M1; % space step, make sure nonlinear<0.05
a]=k-Xh for m1 = 1:1:M1 % Start space evolution
*;E\,,Io u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
@Z}TF/Rx4 u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
m$XMq ca1 = fftshift(fft(u1)); % Take Fourier transform
NW=gi
qB ca2 = fftshift(fft(u2));
:v$][jZ2 c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
$U*b;'o c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
<m"fzT<" u2 = ifft(fftshift(c2)); % Return to physical space
t%S2D u1 = ifft(fftshift(c1));
UnVYGch if rem(m1,J) == 0 % Save output every J steps.
?WEKRl U1 = [U1 u1]; % put solutions in U array
q8m[ S4Q]g U2=[U2 u2];
:{8,O- MN1=[MN1 m1];
bd'io O z1=dz*MN1'; % output location
Vi9Kah+ end
}Od=WQv+ end
V*d@@%u** hg=abs(U1').*abs(U1'); % for data write to excel
4:Ton ha=[z1 hg]; % for data write to excel
K;L6<a A# t1=[0 t'];
n{*A<-vL hh=[t1' ha']; % for data write to excel file
uO^,N**R# %dlmwrite('aa',hh,'\t'); % save data in the excel format
lVptA3F figure(1)
]H {g/C{j
waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
#MyF 1E figure(2)
zg}#X6\G<_ waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
u.yjk/jF y8.3tp 非线性超快脉冲耦合的数值方法的Matlab程序 RKb{QAK!v )\PPIY>iP 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
8"=E0(m 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
}q?*13iy( Tebu?bj zk m#w {3@"}Eh % This Matlab script file solves the nonlinear Schrodinger equations
n_9Wrx328 % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
vp|.x |@ % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
APUpqY % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
JT cE{i 1lLXu C=1;
N2uTWT> M1=120, % integer for amplitude
-n"7G%$M M3=5000; % integer for length of coupler
8+mu'RZ X N = 512; % Number of Fourier modes (Time domain sampling points)
wl Nl|+ K dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
INNTp[ T =40; % length of time:T*T0.
{>h,@ dt = T/N; % time step
]|8*l]oc n = [-N/2:1:N/2-1]'; % Index
FT;I|+H*P t = n.*dt;
!*!i&0QC~R ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
*|B5,Ey w=2*pi*n./T;
j
V'~> g1=-i*ww./2;
=`EVg>+^ g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
dF+R
q|n{ g3=-i*ww./2;
mV;)V8' P1=0;
' JAcN@q~z P2=0;
Z}`A'#! P3=1;
=<.h.n P=0;
SU7 erCHX for m1=1:M1
s*tzU.E( p=0.032*m1; %input amplitude
0?w4 s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
i*61i0 s1=s10;
v$~ZT_"(9 s20=0.*s10; %input in waveguide 2
4c,{Js s30=0.*s10; %input in waveguide 3
-(VX+XHW s2=s20;
#9/S2m2\YG s3=s30;
f)#nXTXeC p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
;~"#aL50fe %energy in waveguide 1
1#V&'A p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
|bX{MF %energy in waveguide 2
]]6 p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
H|8i|vbi %energy in waveguide 3
^K?Mq1"Db for m3 = 1:1:M3 % Start space evolution
"ZR^w5 s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
w9,w?%F s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
OE(!^"5?[ s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
:^ J'_ sca1 = fftshift(fft(s1)); % Take Fourier transform
Ey]P
>J sca2 = fftshift(fft(s2));
X8~gLdv8 sca3 = fftshift(fft(s3));
G|LcTV sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
\w=*:Z sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
[J6q(}f sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
s-e<&*D[ s3 = ifft(fftshift(sc3));
;|D8"D6] s2 = ifft(fftshift(sc2)); % Return to physical space
/9<62F@zJ" s1 = ifft(fftshift(sc1));
9V?:!%J end
TIVrbO\!o p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
$@eFSA5k,7 p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
*GC9o/ p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
~IS3i'bh P1=[P1 p1/p10];
]GmXZi P2=[P2 p2/p10];
QvDD
P3=[P3 p3/p10];
X0BBJ( e P=[P p*p];
*:,y`!F=y end
P3+?gW' figure(1)
xf4`+[ plot(P,P1, P,P2, P,P3);
o0FVVS l 4L/8Hj#g 转自:
http://blog.163.com/opto_wang/