计算脉冲在非线性耦合器中演化的Matlab 程序 ANw1P{9*
{q8|/{; % This Matlab script file solves the coupled nonlinear Schrodinger equations of
b=MW;]F % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
MW rhVn{R % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
Lr*PbjQDIY % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
C$+Q,guM o<!H/PN %fid=fopen('e21.dat','w');
q5e(~@(z<` N = 128; % Number of Fourier modes (Time domain sampling points)
P`Ku.
ONQ M1 =3000; % Total number of space steps
gF)-Ci J =100; % Steps between output of space
dyn)KDS T =10; % length of time windows:T*T0
ig.Z,R3@r T0=0.1; % input pulse width
cK]n"6N[ MN1=0; % initial value for the space output location
vkGF_aenk dt = T/N; % time step
7MrHu2rZ= n = [-N/2:1:N/2-1]'; % Index
Fn`Zw:vp6 t = n.*dt;
e7xv~C>g u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
IWq\M,P u20=u10.*0.0; % input to waveguide 2
xJ/)*?@+ u1=u10; u2=u20;
7!jb U1 = u1;
F6yFKNK!n U2 = u2; % Compute initial condition; save it in U
O8\f]!O( ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
&&C70+_po w=2*pi*n./T;
Q}B]b-c+E g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
8h=m()Eu L=4; % length of evoluation to compare with S. Trillo's paper
hizM}d-"C dz=L/M1; % space step, make sure nonlinear<0.05
)GG9[%H! for m1 = 1:1:M1 % Start space evolution
N80ogio_Tk u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
)YEAk@h@ u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
+:jonN9d ca1 = fftshift(fft(u1)); % Take Fourier transform
ya~;Of5 ca2 = fftshift(fft(u2));
v4|TQ8!wR c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
I[K4/91 c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
au50%sA~
u2 = ifft(fftshift(c2)); % Return to physical space
v^o`+~i u1 = ifft(fftshift(c1));
fWEQ vQ if rem(m1,J) == 0 % Save output every J steps.
%zGv+H? U1 = [U1 u1]; % put solutions in U array
1ds4C:M+< U2=[U2 u2];
`x
_(EZ MN1=[MN1 m1];
I(R%j]LX& z1=dz*MN1'; % output location
|33t 5}we end
L{jx'[C end
Jb*QlsGd hg=abs(U1').*abs(U1'); % for data write to excel
6ZHeAb]" ha=[z1 hg]; % for data write to excel
=ZURh_{xV t1=[0 t'];
ER9{D$ hh=[t1' ha']; % for data write to excel file
Lwi"K8.u %dlmwrite('aa',hh,'\t'); % save data in the excel format
P2jh[a% figure(1)
Ve"(}z waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
xf;>o$oN0P figure(2)
M-h+'G waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
m0^ "fMV v+{{j|x= 非线性超快脉冲耦合的数值方法的Matlab程序 1K/ : F%p DF\ 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
Ow> u!P! 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
6:%lxG H:hM(m0?q L%$-?O| iupkb % This Matlab script file solves the nonlinear Schrodinger equations
V0>[bzI % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
E]n]_{BN] % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
(OE S~G % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
?+d{Rh)y XTX/vbge3m C=1;
/# Jvt M1=120, % integer for amplitude
%.`u2'^ M3=5000; % integer for length of coupler
,_YI:xie|c N = 512; % Number of Fourier modes (Time domain sampling points)
sdO8;v> dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
<S7SH-{_\ T =40; % length of time:T*T0.
WynTU? dt = T/N; % time step
EmO[-W|2 n = [-N/2:1:N/2-1]'; % Index
TEo t = n.*dt;
:35h0;8+ ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
<?IDCOt ? w=2*pi*n./T;
iP9]b& g1=-i*ww./2;
:^`j:B g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
Rkk`+0K7$J g3=-i*ww./2;
;rT/gwg! P1=0;
46)[F0,$r P2=0;
bf.+Ewb( P3=1;
/f?;,CyI P=0;
\9p.I?= for m1=1:M1
(@*|[wN p=0.032*m1; %input amplitude
zP0<4E$M` s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
"zNS6I?rzE s1=s10;
b*S,8vE] s20=0.*s10; %input in waveguide 2
3,G|oR{D s30=0.*s10; %input in waveguide 3
,2Ed^!` s2=s20;
vA:ZR=)F s3=s30;
p#4*:rpq4 p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
J&h59dm- %energy in waveguide 1
: 9(kU p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
3C!|!N1Hn %energy in waveguide 2
a'Cny(( p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
B0yGr\KJ %energy in waveguide 3
1yF9zKs&_ for m3 = 1:1:M3 % Start space evolution
]!S#[Wt {k s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
={cM6F}a@ s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
^pe/~ :a s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
S"Vr+x? sca1 = fftshift(fft(s1)); % Take Fourier transform
:,p3&2I sca2 = fftshift(fft(s2));
:
^}!"4{ sca3 = fftshift(fft(s3));
@ ^F{ sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
L T`T~|pz sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
|b='DJz2 sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
GNmP_N s3 = ifft(fftshift(sc3));
rusM]Z s2 = ifft(fftshift(sc2)); % Return to physical space
-,/6 Wn'j s1 = ifft(fftshift(sc1));
J_&cI%. end
Z-CA9&4Uh p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
3`SH-"{j% p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
/o$6"~t p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
8Wtr,%82 P1=[P1 p1/p10];
+K'YVB
U} P2=[P2 p2/p10];
]5*H/8Ke7 P3=[P3 p3/p10];
3nhQ^zqf P=[P p*p];
n=d#Fm0< end
3_;=y\F figure(1)
{c?{M.R plot(P,P1, P,P2, P,P3);
zBTxM ho^c#>81 转自:
http://blog.163.com/opto_wang/