计算脉冲在非线性耦合器中演化的Matlab 程序 .4t-5,7s% Y&G]M % This Matlab script file solves the coupled nonlinear Schrodinger equations of
F$|Ec9 % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
MPexc5_ % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
\Y>!vh X % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
[K*>W[n $@ous4& %fid=fopen('e21.dat','w');
b?=>)':f N = 128; % Number of Fourier modes (Time domain sampling points)
U{)|z-n M1 =3000; % Total number of space steps
/]_a\x5Ss J =100; % Steps between output of space
JUf{;nt T =10; % length of time windows:T*T0
Q>G lA
T0=0.1; % input pulse width
|JR;E$ MN1=0; % initial value for the space output location
7%%FYHMO: dt = T/N; % time step
UC u4S > n = [-N/2:1:N/2-1]'; % Index
nB8JdM2h{ t = n.*dt;
6v]y\+ u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
JfrPK/Vn u20=u10.*0.0; % input to waveguide 2
uB`H9 u1=u10; u2=u20;
K|OowM4tv U1 = u1;
viLK\>> U2 = u2; % Compute initial condition; save it in U
cNd;qO0$ ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
K F:W:8 w=2*pi*n./T;
^2|G0d@.: g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
{m<NPtp910 L=4; % length of evoluation to compare with S. Trillo's paper
.5t|FJ]`$ dz=L/M1; % space step, make sure nonlinear<0.05
FtEmSKD for m1 = 1:1:M1 % Start space evolution
hDP&~Mk u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
K4H U9! u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
ssWSY(j] ca1 = fftshift(fft(u1)); % Take Fourier transform
B?-~f^*,jG ca2 = fftshift(fft(u2));
_w'N c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
W=$cQ(x4Z c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
B(omD3jzN u2 = ifft(fftshift(c2)); % Return to physical space
5@:c6(5$ u1 = ifft(fftshift(c1));
bsn.HT"5 if rem(m1,J) == 0 % Save output every J steps.
Zl:Z31 U1 = [U1 u1]; % put solutions in U array
Mzbbr57n U2=[U2 u2];
JyfWy MN1=[MN1 m1];
MgP6ki1z z1=dz*MN1'; % output location
u`Sg' ro end
OE"r=is end
!Q0aKkMfL hg=abs(U1').*abs(U1'); % for data write to excel
,^>WCG ha=[z1 hg]; % for data write to excel
Yw\7` t1=[0 t'];
0VA$
Ige hh=[t1' ha']; % for data write to excel file
z1WF@Ej %dlmwrite('aa',hh,'\t'); % save data in the excel format
Z,? T`[4B figure(1)
RyJN=;5p waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
s-z*Lq* figure(2)
S>'S4MJE` waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
gLH#UwfJ cSkJlhwNn 非线性超快脉冲耦合的数值方法的Matlab程序 jDaWmy<ha ;`TSu5/ 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
hZudVBn 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
?
7H'#l y*AB=d^ #hNp1y2 Rzolue 8 % This Matlab script file solves the nonlinear Schrodinger equations
Ga%x(1U[& % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
|PI]v`[ % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
+mr\AAFn % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
syseYt] `!K!+`Z9 C=1;
q,W6wM;,E M1=120, % integer for amplitude
T\Zq/Z\ M3=5000; % integer for length of coupler
y'a(>s( N = 512; % Number of Fourier modes (Time domain sampling points)
@
k`^Z5tN dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
:=<0Z1S T =40; % length of time:T*T0.
/j{`hi dt = T/N; % time step
X~H~k1 n = [-N/2:1:N/2-1]'; % Index
RZV8{ t = n.*dt;
@`</Z) ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
5_d=~whO&2 w=2*pi*n./T;
|&>!"27;w g1=-i*ww./2;
@rTAbEk{U g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
]{[8$|Mg g3=-i*ww./2;
6]#\|lds1 P1=0;
iTt#%Fs)4M P2=0;
nt"8kv P3=1;
jv"^_1 P=0;
`#m>3 for m1=1:M1
]/_GHG9 p=0.032*m1; %input amplitude
^aW?0qsH s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
T}?vp~./ s1=s10;
2WA =U] s20=0.*s10; %input in waveguide 2
&|:T+LVv$+ s30=0.*s10; %input in waveguide 3
s 4Mi9h_ s2=s20;
""dX4^gtU s3=s30;
K-xmLEu p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
aWLeyXsAu %energy in waveguide 1
f>u{e~Q, p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
=uYz4IDB %energy in waveguide 2
"/EE$eU p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
a-`OE" %energy in waveguide 3
4HG@moYn@ for m3 = 1:1:M3 % Start space evolution
Y'.WO[dgf s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
#$vef
s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
sH^?v0^a s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
$J~~.PUXQ sca1 = fftshift(fft(s1)); % Take Fourier transform
H& #Od? sca2 = fftshift(fft(s2));
5>XrNc91 sca3 = fftshift(fft(s3));
O\5*p=v sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
"hRY+{m sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
J.`z;0]op sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
jU#/yM"Y s3 = ifft(fftshift(sc3));
O1o.^i$-M s2 = ifft(fftshift(sc2)); % Return to physical space
fs]9H K/@\ s1 = ifft(fftshift(sc1));
JJvf!] end
OFJ
T p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
[_3Rhp: p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
=jik33QV< p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
S=Ihg
P1=[P1 p1/p10];
$RQ7rL3g{ P2=[P2 p2/p10];
u5f+%!p P3=[P3 p3/p10];
;w(]z P=[P p*p];
>`jsUeS end
$z7[RLu0! figure(1)
+s6wF{ plot(P,P1, P,P2, P,P3);
1MtvnPY -DO*,Eecv 转自:
http://blog.163.com/opto_wang/