计算脉冲在非线性耦合器中演化的Matlab 程序 >R"]{y It.G-( % This Matlab script file solves the coupled nonlinear Schrodinger equations of
2L}F=$zz % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
[]R`h*# % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
c zTr_> % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
oGz-lO{lt RzG7Xr=t %fid=fopen('e21.dat','w');
f?)BAah N = 128; % Number of Fourier modes (Time domain sampling points)
(dZu& M1 =3000; % Total number of space steps
p^1s9CM% J =100; % Steps between output of space
)Zx;Z[ T =10; % length of time windows:T*T0
wxw3t@%mNm T0=0.1; % input pulse width
/~`4a MN1=0; % initial value for the space output location
>
cFH=um dt = T/N; % time step
!bEy~. n = [-N/2:1:N/2-1]'; % Index
@64PdM!L t = n.*dt;
$RA8U:Q!1e u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
!ER,o_T< u20=u10.*0.0; % input to waveguide 2
6
6S
I u1=u10; u2=u20;
7P!<c/ E U1 = u1;
2xy
&mNx U2 = u2; % Compute initial condition; save it in U
*xY}?vSs ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
s~OGlPK w=2*pi*n./T;
[k)xn3[ g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
pU4k/v555; L=4; % length of evoluation to compare with S. Trillo's paper
]ADj9 dz=L/M1; % space step, make sure nonlinear<0.05
d&mSoPf for m1 = 1:1:M1 % Start space evolution
q1C) *8*g u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
#NU;$& u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
o/Z ca1 = fftshift(fft(u1)); % Take Fourier transform
K/)*P4C- ca2 = fftshift(fft(u2));
t+C9QXY c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
|l5ol@2* c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
vFuf{ @P u2 = ifft(fftshift(c2)); % Return to physical space
lP$bxUNt u1 = ifft(fftshift(c1));
1CS[%)-c if rem(m1,J) == 0 % Save output every J steps.
?LE\pk
R U1 = [U1 u1]; % put solutions in U array
1eiV[z$? U2=[U2 u2];
N>8pA) MN1=[MN1 m1];
v X=zqV z1=dz*MN1'; % output location
_^{!`*S end
Nr24Rv end
_
U/[n\oC hg=abs(U1').*abs(U1'); % for data write to excel
{J_1.uN= ha=[z1 hg]; % for data write to excel
H oA[UT t1=[0 t'];
rl#[HbPM hh=[t1' ha']; % for data write to excel file
VXr'Z %dlmwrite('aa',hh,'\t'); % save data in the excel format
%Ot2bhK; figure(1)
Snm
m(. waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
i-6,r [< figure(2)
<A% } waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
Wz}DC7 hEG-,
非线性超快脉冲耦合的数值方法的Matlab程序 | g o jb
U~%V;*|4 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
879x(JII 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
5v1f?btc lHg&|S&J Yc5{M*w \SA"DT % This Matlab script file solves the nonlinear Schrodinger equations
^;on % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
r3~~4Q4XI> % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
TRB)cJZ? % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
^Rgm3?7 0}(ZW~&1 C=1;
AGxtmBB; M1=120, % integer for amplitude
SkGh@\ M3=5000; % integer for length of coupler
zGm#erE N = 512; % Number of Fourier modes (Time domain sampling points)
014p = W dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
G=rgL'{ T =40; % length of time:T*T0.
HH_w!_f dt = T/N; % time step
gu'Y k n = [-N/2:1:N/2-1]'; % Index
V1aWVLltj t = n.*dt;
\FVm_) ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
`S&(J2KV w=2*pi*n./T;
-68E]O g1=-i*ww./2;
-c%K_2` g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
%cy]dEL7 g3=-i*ww./2;
K|"97{*|2 P1=0;
1h.Ypzu P2=0;
+59tX2@Q P3=1;
ym>>5 (bni P=0;
fpj,~+ for m1=1:M1
DA>_9o/l p=0.032*m1; %input amplitude
~g&FeMo s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
@fDWp/ s1=s10;
[&IJy s20=0.*s10; %input in waveguide 2
d E0
`tX s30=0.*s10; %input in waveguide 3
]QB<N|ps s2=s20;
<2{CR0]u s3=s30;
[^iQE p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
ze%kP#c6!
%energy in waveguide 1
/FzO9'kj p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
qu}`;\9@ld %energy in waveguide 2
AOh\%|} p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
{J`]6 ba %energy in waveguide 3
|
rY.IbL for m3 = 1:1:M3 % Start space evolution
XYBvM] s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
I-@A{vvPK s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
Pfy2PpA s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
N>Dr
z sca1 = fftshift(fft(s1)); % Take Fourier transform
bnso+cA sca2 = fftshift(fft(s2));
FiN^}Kh sca3 = fftshift(fft(s3));
*'b3Z3c,; sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
:>@6\ sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
$d<vPpJ3 sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
80i-)a\n s3 = ifft(fftshift(sc3));
Y)X
'hk)5| s2 = ifft(fftshift(sc2)); % Return to physical space
iX3Y:
s1 = ifft(fftshift(sc1));
^lF'KW$ end
%'}zr>tx: p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
J>H$4t#HX p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
.XD.'S p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
HnDz4eD P1=[P1 p1/p10];
x,f=J4yco P2=[P2 p2/p10];
6qCRM *V P3=[P3 p3/p10];
^A4bsoW P=[P p*p];
%kod31X3< end
-vRZCIj! figure(1)
d0@&2hO plot(P,P1, P,P2, P,P3);
J%_m`? '<Nhq_u{ 转自:
http://blog.163.com/opto_wang/