计算脉冲在非线性耦合器中演化的Matlab 程序
bLqy!QE 5!Bktgk. % This Matlab script file solves the coupled nonlinear Schrodinger equations of
5o#Yt % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
_d@=nK) % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
Y>BP?l % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
JWROYED X eoJ$PfT %fid=fopen('e21.dat','w');
q_ %cbAcD N = 128; % Number of Fourier modes (Time domain sampling points)
[ |[>}z: M1 =3000; % Total number of space steps
k6!4Zz_8 J =100; % Steps between output of space
*:_P8G; T =10; % length of time windows:T*T0
B<7/,d' T0=0.1; % input pulse width
EATu KLP\ MN1=0; % initial value for the space output location
y:d{jG^ dt = T/N; % time step
@m~RtC-Q n = [-N/2:1:N/2-1]'; % Index
B6]<G- t = n.*dt;
o%[U u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
&.Q8Mi
aT u20=u10.*0.0; % input to waveguide 2
[3N[i(Wlk u1=u10; u2=u20;
w5KPB5/zu U1 = u1;
u=r`t(Z1H U2 = u2; % Compute initial condition; save it in U
#`;/KNp 9 ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
2 -Xdoxw w=2*pi*n./T;
)zq.4 g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
K=?VDN L=4; % length of evoluation to compare with S. Trillo's paper
ar.AL' dz=L/M1; % space step, make sure nonlinear<0.05
]3B %8 for m1 = 1:1:M1 % Start space evolution
|.P/:e9 u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
Jq
]:<TQ u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
9b;A1gu ca1 = fftshift(fft(u1)); % Take Fourier transform
Q7gY3flg ca2 = fftshift(fft(u2));
@]HXP_lyD/ c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
~]'pY c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
iWLa> z|, u2 = ifft(fftshift(c2)); % Return to physical space
la
<npX u1 = ifft(fftshift(c1));
\}_Yd8 if rem(m1,J) == 0 % Save output every J steps.
:q#K} / U1 = [U1 u1]; % put solutions in U array
EE=3 U2=[U2 u2];
Vp}^NNYf MN1=[MN1 m1];
2+o|A z1=dz*MN1'; % output location
1tMQqI`N end
U__(;
/1; end
G{9X)|d
hg=abs(U1').*abs(U1'); % for data write to excel
xSK~s ha=[z1 hg]; % for data write to excel
28andfl t1=[0 t'];
*[+)7 hh=[t1' ha']; % for data write to excel file
QHt4",Ij %dlmwrite('aa',hh,'\t'); % save data in the excel format
O
5Nb figure(1)
?BA^YF waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
LN2D figure(2)
Oco YV J waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
=Gk/k}1 J#2!ZQE
3 非线性超快脉冲耦合的数值方法的Matlab程序 C'A]i5 ,`A?!.K$ 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
KvPX=/&Zu 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
a`(a)9i p4K.NdUH h*B|fy4K9U ULH0'@BJ % This Matlab script file solves the nonlinear Schrodinger equations
C0*@0~8$9 % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
V DS23Bo % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
j2l55@ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
X+k}2HvNG 7OCwG~_^ C=1;
$,>@o=)_ M1=120, % integer for amplitude
,m<H-gwa M3=5000; % integer for length of coupler
3jH \yXj N = 512; % Number of Fourier modes (Time domain sampling points)
evA/+F,& dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
(b,[C\RBF T =40; % length of time:T*T0.
in`aGFQO dt = T/N; % time step
U$dh1; n = [-N/2:1:N/2-1]'; % Index
dsx]/49< t = n.*dt;
s@hRqGd: ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
P^`duZ{T w=2*pi*n./T;
OS|> t./U g1=-i*ww./2;
^D`v3d g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
3bZIYF2@ g3=-i*ww./2;
Wo~vhv$E P1=0;
:,b
iyJt P2=0;
:u8(^]N P3=1;
0Uk@\[1ox P=0;
SUKxkc( for m1=1:M1
4MuO1W- p=0.032*m1; %input amplitude
S [h];eM s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
!+)AeDc:j s1=s10;
UO*Ymj
1 s20=0.*s10; %input in waveguide 2
p[lNy{u~M s30=0.*s10; %input in waveguide 3
v[plT2"s s2=s20;
#GDe08rOw s3=s30;
5]I| DHmu p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
RB* J= %energy in waveguide 1
U7uKRv9 p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
C98]9 %energy in waveguide 2
'bld,Do6 p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
I+>%uShm %energy in waveguide 3
W>VP'vn} for m3 = 1:1:M3 % Start space evolution
"<_0A f] s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
l\M_-:I+4 s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
@_:]J1jw7 s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
?m$a6'2-,J sca1 = fftshift(fft(s1)); % Take Fourier transform
53-v|'9' sca2 = fftshift(fft(s2));
r78TE@d sca3 = fftshift(fft(s3));
|#1(Z-} sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
1]IQg;q sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
N]KxAttt sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
Mu'8;9_6 s3 = ifft(fftshift(sc3));
`n$5+a+ s2 = ifft(fftshift(sc2)); % Return to physical space
[,2|Flf
e s1 = ifft(fftshift(sc1));
<mi-}s end
.h0b~nI>> p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
/Q~gU< p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
HB
Iip? p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
zIP6\u P1=[P1 p1/p10];
pv^O"Bs P2=[P2 p2/p10];
'*\|;l#1 P3=[P3 p3/p10];
"#( T P=[P p*p];
Hwo$tVa:= end
~QvqG{bFB figure(1)
kP/M<X" plot(P,P1, P,P2, P,P3);
6s0_#wZC CR6R?R3b 转自:
http://blog.163.com/opto_wang/