计算脉冲在非线性耦合器中演化的Matlab 程序 97~>gFU77# I0qJr2[X~ % This Matlab script file solves the coupled nonlinear Schrodinger equations of
sWB@'P:x % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
0+u>"7T % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
,Xr`tQ<@ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
9dm<(I} H_Xk;fM %fid=fopen('e21.dat','w');
^;F5ymb3U N = 128; % Number of Fourier modes (Time domain sampling points)
]0BX5Z' M1 =3000; % Total number of space steps
6nREuT'k J =100; % Steps between output of space
n`@dk_%yI T =10; % length of time windows:T*T0
f( Dtv T0=0.1; % input pulse width
z`.<dNg MN1=0; % initial value for the space output location
,fqM>Q dt = T/N; % time step
6kMkFZ}+ n = [-N/2:1:N/2-1]'; % Index
xR8.1T?8 t = n.*dt;
>2=
Y 35j u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
RWX!d54& u20=u10.*0.0; % input to waveguide 2
<1B+@ u1=u10; u2=u20;
~mwIr U1 = u1;
8!HB$vdw7 U2 = u2; % Compute initial condition; save it in U
7\[fjCg\w ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
bwcr/J(Nb w=2*pi*n./T;
t\a|Gp W g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
2i;ox*SfpU L=4; % length of evoluation to compare with S. Trillo's paper
cA|vH^: dz=L/M1; % space step, make sure nonlinear<0.05
gFrNk
Uqp for m1 = 1:1:M1 % Start space evolution
>]&Ow9- u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
Yi)s=Q : u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
t%J1(H ca1 = fftshift(fft(u1)); % Take Fourier transform
Z[ &d2' ca2 = fftshift(fft(u2));
ekU%^R< c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
Jz3,vVfQ: c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
M] +.xo+A u2 = ifft(fftshift(c2)); % Return to physical space
vU5}E\Ny u1 = ifft(fftshift(c1));
;<thEWH;Y if rem(m1,J) == 0 % Save output every J steps.
KV$4}{ U1 = [U1 u1]; % put solutions in U array
D6|-nl U2=[U2 u2];
^sFO[cYo MN1=[MN1 m1];
i pl,{ z1=dz*MN1'; % output location
Gi#-TP\ end
V0#Ocq, end
k<CbI
V hg=abs(U1').*abs(U1'); % for data write to excel
Hb::;[bm: ha=[z1 hg]; % for data write to excel
Dte5g),R t1=[0 t'];
erbk( hh=[t1' ha']; % for data write to excel file
Gk/cP` %dlmwrite('aa',hh,'\t'); % save data in the excel format
%?aq1 =B figure(1)
>T c\~l waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
j;7E+Yp figure(2)
s@5~HyeI waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
{7c'%e YYPJ(o\ 非线性超快脉冲耦合的数值方法的Matlab程序 m{?f,Q=u@ yjMN>L' 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
JAP(J~ 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
s,8zj<dUv ;^0rY )& |FM*1Q[1 '21gUYm % This Matlab script file solves the nonlinear Schrodinger equations
S4[#[w`= % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
k4hk*
0Jq % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
3Jt#
Mp % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
(_<,Oj#*S S*|/txE'~Y C=1;
=-X-${/ M1=120, % integer for amplitude
M@<9/xPS M3=5000; % integer for length of coupler
vNrn]v=|}7 N = 512; % Number of Fourier modes (Time domain sampling points)
i}P{{kMJ dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
%Nvw`H T =40; % length of time:T*T0.
`]XI Q\ * dt = T/N; % time step
X<Z(,B n = [-N/2:1:N/2-1]'; % Index
fByf~iv, t = n.*dt;
XD|g G ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
l
v hJ w=2*pi*n./T;
uC#@qpzy g1=-i*ww./2;
;H.V-~:P) g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
mfaU_Vo& g3=-i*ww./2;
_p+E(i 9 P1=0;
jVQ89vf
~ P2=0;
@sA!o[gH P3=1;
FE&:? P=0;
9J?s:"j for m1=1:M1
0.0-rd> p=0.032*m1; %input amplitude
>h#w~@e:: s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
{vCtp s1=s10;
t(-,mw s20=0.*s10; %input in waveguide 2
nH k^trGm s30=0.*s10; %input in waveguide 3
$P?^GB>u s2=s20;
_`&l46 s3=s30;
$Oy&POe p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
16~E %energy in waveguide 1
D_0Vu/v p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
C-;w}
%energy in waveguide 2
){"?@1vP p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
OQB7C0+ & %energy in waveguide 3
W_JO~P for m3 = 1:1:M3 % Start space evolution
E'DHO2
Y s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
T-6<qh s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
3u$1W@T( s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
qrw sca1 = fftshift(fft(s1)); % Take Fourier transform
6X%g-aTs sca2 = fftshift(fft(s2));
n"6L\u sca3 = fftshift(fft(s3));
=!^
gQ0~4 sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
v/c]=/ sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
T!KwRxJ23 sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
S* O .
? s3 = ifft(fftshift(sc3));
ZDbe]9#Xh s2 = ifft(fftshift(sc2)); % Return to physical space
ChG7>4:\ s1 = ifft(fftshift(sc1));
^zQI_ydG end
yvoz 3_! p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
o5?Y
p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
II}M|qHaK p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
s) shq3O P1=[P1 p1/p10];
aYb97}kI P2=[P2 p2/p10];
;ISnI P3=[P3 p3/p10];
3yKmuu! P=[P p*p];
Tgr,1)T end
2icQ (H; figure(1)
U\tx{CsSz plot(P,P1, P,P2, P,P3);
yW=+6@A4 *??lwvJp 转自:
http://blog.163.com/opto_wang/