计算脉冲在非线性耦合器中演化的Matlab 程序 d=o|)kV ^ ~:f02[D % This Matlab script file solves the coupled nonlinear Schrodinger equations of
.9
mwRYgD % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
,=O`'l>K % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
iE=Yh % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
gV$j ] l9lBhltOH %fid=fopen('e21.dat','w');
k<Z^93 S N = 128; % Number of Fourier modes (Time domain sampling points)
'C8VD+p M1 =3000; % Total number of space steps
U":hJ*F) J =100; % Steps between output of space
]>E*s3h T =10; % length of time windows:T*T0
0^az<!!O# T0=0.1; % input pulse width
;&q}G1 MN1=0; % initial value for the space output location
J0*hJ-/u dt = T/N; % time step
L3JFQc/oh~ n = [-N/2:1:N/2-1]'; % Index
%obR2% t = n.*dt;
X^ckTIdR u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
_Db=I3.HJ u20=u10.*0.0; % input to waveguide 2
rL3<r u1=u10; u2=u20;
n$
$^(-g@) U1 = u1;
Py$Q]s?\1 U2 = u2; % Compute initial condition; save it in U
GwQW
I] ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
$,v
'> w=2*pi*n./T;
bXF>{%(}E g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
-G e5gQ= L=4; % length of evoluation to compare with S. Trillo's paper
X,n4_=f dz=L/M1; % space step, make sure nonlinear<0.05
$h`(toTyF for m1 = 1:1:M1 % Start space evolution
C93BK)$} u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
{e\Pd!D?| u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
gKeqf-UWKJ ca1 = fftshift(fft(u1)); % Take Fourier transform
8]skAh ca2 = fftshift(fft(u2));
,(dg]7 c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
v".q578
0B c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
#no~g(!o u2 = ifft(fftshift(c2)); % Return to physical space
1rKKp h u1 = ifft(fftshift(c1));
eQu%TZ(x-$ if rem(m1,J) == 0 % Save output every J steps.
>J[Bf9)> U1 = [U1 u1]; % put solutions in U array
Se<]g$eK?5 U2=[U2 u2];
n8UQIa4&= MN1=[MN1 m1];
n|2`y? z1=dz*MN1'; % output location
m^0r9y, end
s0uI;WMg end
wI><kdz hg=abs(U1').*abs(U1'); % for data write to excel
2+zE|I. ha=[z1 hg]; % for data write to excel
ma9q?H#X t1=[0 t'];
Yv k
Qh{ hh=[t1' ha']; % for data write to excel file
;iR( Ir %dlmwrite('aa',hh,'\t'); % save data in the excel format
=M'M/vKD figure(1)
rqW[B/a{ waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
HM57b>6 figure(2)
A]ZCQ49 waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
oNQ;9&Z,^2 W&CQ87b 非线性超快脉冲耦合的数值方法的Matlab程序 59mNb:< oJa6)+b(3 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
bwo-9B 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
x2x)y08 w}No ^.I*4 cpvN
}G Wt5x*p-!C % This Matlab script file solves the nonlinear Schrodinger equations
g?`g+:nug % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
W9n0Jv % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
]T|9>o! % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
QR4rQu uw! C=1;
h07Z.q ; M1=120, % integer for amplitude
e9e%8hL M3=5000; % integer for length of coupler
MJNY#v3 N = 512; % Number of Fourier modes (Time domain sampling points)
F x,08 dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
io:g]g T =40; % length of time:T*T0.
Rs_0xh dt = T/N; % time step
ah<1&UG, n = [-N/2:1:N/2-1]'; % Index
uo0g51%9 t = n.*dt;
[
[]'U' ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
'F%4[3a$\n w=2*pi*n./T;
?xEQ'(UBQ g1=-i*ww./2;
{Hncm g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
06DT2 g3=-i*ww./2;
r_C|gfIP P1=0;
[-o`^; P2=0;
HR)Dz~Obw P3=1;
pRI<L' P=0;
mr:;Wwd for m1=1:M1
RtVy^~=G p=0.032*m1; %input amplitude
~3byAL s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
O@JgVdgf s1=s10;
,XT#V\qne s20=0.*s10; %input in waveguide 2
)E;+C2G s30=0.*s10; %input in waveguide 3
~RcI+jR) s2=s20;
1d/-SxhZ s3=s30;
]jbQou@ p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
[h>|6%sW %energy in waveguide 1
W>C!V p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
\#4??@+Xf %energy in waveguide 2
FTM(y CN p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
is=sV:j: %energy in waveguide 3
&qw7BuF for m3 = 1:1:M3 % Start space evolution
%Q]u_0P* s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
").MU[q%Y s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
*r!f! eA: s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
l;i,V;@t sca1 = fftshift(fft(s1)); % Take Fourier transform
_&S?uz m sca2 = fftshift(fft(s2));
TDI8L\rr sca3 = fftshift(fft(s3));
>55c{|"@L sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
a<X8l^Ln sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
DLMG<4Cd~ sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
}~P%S(zB s3 = ifft(fftshift(sc3));
kp3(/`xP s2 = ifft(fftshift(sc2)); % Return to physical space
|8I #` s1 = ifft(fftshift(sc1));
OJd!g/V end
(;u tiupW p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
Y"
9 o p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
KTn,}7vZ p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
w:Ui_-4*> P1=[P1 p1/p10];
1-Fg_G}|6 P2=[P2 p2/p10];
\)'nxFKqV P3=[P3 p3/p10];
!_GY\@} P=[P p*p];
)6|7L)Dk end
jvx9b([<sG figure(1)
~~:w^(s9 plot(P,P1, P,P2, P,P3);
$ tf;\R 4 -)'a} O 转自:
http://blog.163.com/opto_wang/