计算脉冲在非线性耦合器中演化的Matlab 程序 (sN;B) :I/i"g7< % This Matlab script file solves the coupled nonlinear Schrodinger equations of
R8n/QCeY{ % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
KoF_G[m % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
n[tES6u % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
-JwwD6D #}|g8gh %fid=fopen('e21.dat','w');
uX8yS|= * N = 128; % Number of Fourier modes (Time domain sampling points)
Lcow2 SbH M1 =3000; % Total number of space steps
ReZ&SNJ J =100; % Steps between output of space
V0)F/qY T =10; % length of time windows:T*T0
r]lPXj(` T0=0.1; % input pulse width
WB(Gx_o3 MN1=0; % initial value for the space output location
2/4,iu(T`c dt = T/N; % time step
#dEMjD n = [-N/2:1:N/2-1]'; % Index
ML-?#jNa< t = n.*dt;
CF0i72ul5 u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
l?J|Ip2W u20=u10.*0.0; % input to waveguide 2
8AQ@?\Rc"2 u1=u10; u2=u20;
vzPuk|q3 U1 = u1;
ON
q =b I* U2 = u2; % Compute initial condition; save it in U
b9cY ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
MbJ|6g99 w=2*pi*n./T;
Z`{ZV5 g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
X|wg7>kh*` L=4; % length of evoluation to compare with S. Trillo's paper
o|O|e9m( dz=L/M1; % space step, make sure nonlinear<0.05
4 /Q4sE~< for m1 = 1:1:M1 % Start space evolution
d@IV@'Q7u u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
.^aqzA=] u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
2uy<wJE> ca1 = fftshift(fft(u1)); % Take Fourier transform
7'1 +i ca2 = fftshift(fft(u2));
A$;"9F@ c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
}[c,/NH c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
-FrNk> u2 = ifft(fftshift(c2)); % Return to physical space
KE*8Y4#9 u1 = ifft(fftshift(c1));
\\{+t<?J if rem(m1,J) == 0 % Save output every J steps.
:$5$H U1 = [U1 u1]; % put solutions in U array
/@`kM'1:
U2=[U2 u2];
j8|N;;MN MN1=[MN1 m1];
SdM@7%UK z1=dz*MN1'; % output location
V9cKl[ end
ObIL w end
zEN3Nn.8 hg=abs(U1').*abs(U1'); % for data write to excel
bz4TbGg] ha=[z1 hg]; % for data write to excel
9fQFsI t1=[0 t'];
uE%$<o*# hh=[t1' ha']; % for data write to excel file
j|X>:!4r %dlmwrite('aa',hh,'\t'); % save data in the excel format
yK"T5^o figure(1)
"CcdwWM waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
\I[50eh| figure(2)
Yv ZcG3@c3 waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
@?E|]H!S] *%;+3SV 非线性超快脉冲耦合的数值方法的Matlab程序 >jH%n(TcC U,e'vS{ 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
(m%A>e
B 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
~P;KO40K &w7Ev21 m&!4*D 4k4 d% % This Matlab script file solves the nonlinear Schrodinger equations
hiBZZ+^[ % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
l Taw6; % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
C0v1x=(xiM % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
b`yb{&
,? Lw_s'QNWR C=1;
& Y Y^Bd# M1=120, % integer for amplitude
S%{^@L+V M3=5000; % integer for length of coupler
uS}qy-8J N = 512; % Number of Fourier modes (Time domain sampling points)
\!Cc[n(f# dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
/t"FZ# T =40; % length of time:T*T0.
%f'mW2 dt = T/N; % time step
) u
Sg;B4 n = [-N/2:1:N/2-1]'; % Index
Pua|Z
x t = n.*dt;
]~!?(d!J/ ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
{Z!x]}{M w=2*pi*n./T;
?=#vp / g1=-i*ww./2;
s.]<r5v7 g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
DITo.PU g3=-i*ww./2;
3 jR I@ P1=0;
SSo7
U P2=0;
p;0p!~F=49 P3=1;
mJN*DP{ P=0;
rO3.%B} for m1=1:M1
7uq/C#N p=0.032*m1; %input amplitude
*3Qwmom s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
J,SP1-L s1=s10;
)oAx t70 s20=0.*s10; %input in waveguide 2
pEp`Z,p s30=0.*s10; %input in waveguide 3
sDXD>upO s2=s20;
'^10sf`" s3=s30;
rK@XC +`S p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
::`#qa4! %energy in waveguide 1
p()#+Xy p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
9S_PZH %energy in waveguide 2
4-vo R5Fd p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
X"Ca %energy in waveguide 3
e !2SO*O for m3 = 1:1:M3 % Start space evolution
7H!/et?S, s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
T
j(MIFi|5 s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
;U)xZ _Ew~ s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
'nRoa7v( sca1 = fftshift(fft(s1)); % Take Fourier transform
{a9(
Qi sca2 = fftshift(fft(s2));
#X t|"Z sca3 = fftshift(fft(s3));
w]O[{3" sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
#AO?<L sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
=IH~:D\& sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
M)6iYA%$ s3 = ifft(fftshift(sc3));
CFTw=b@ s2 = ifft(fftshift(sc2)); % Return to physical space
;Y9-0W s1 = ifft(fftshift(sc1));
7U647G(Sg end
Uu_Es{@ p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
.$"13" p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
bGtS! 'I p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
PX/7 :D? P1=[P1 p1/p10];
N(Sc!rX P2=[P2 p2/p10];
gzd<D}2F~ P3=[P3 p3/p10];
+=M N_ P=[P p*p];
6"YcM:5~ end
YG_|L[/# figure(1)
PrqyJ plot(P,P1, P,P2, P,P3);
(|9t+KP 4..M *U 转自:
http://blog.163.com/opto_wang/