计算脉冲在非线性耦合器中演化的Matlab 程序 9I}-[|`u B} lvr-c# % This Matlab script file solves the coupled nonlinear Schrodinger equations of
D)L+7N0D~ % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
~ _/(t'9 % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
6}d.5^7lr % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
vX/T3WV
a{L
d %fid=fopen('e21.dat','w');
MF5[lK9e N = 128; % Number of Fourier modes (Time domain sampling points)
ML|FQ M1 =3000; % Total number of space steps
%J+E/ J =100; % Steps between output of space
.yz}ROmN^ T =10; % length of time windows:T*T0
Y$"O
VC T0=0.1; % input pulse width
<J)]mh dm MN1=0; % initial value for the space output location
As'=tIro dt = T/N; % time step
hb}+A=A=+ n = [-N/2:1:N/2-1]'; % Index
aDU<wxnSvO t = n.*dt;
=vX/{C u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
~"nxE u20=u10.*0.0; % input to waveguide 2
N sXHO u1=u10; u2=u20;
16=sij%A U1 = u1;
YtmrRDQs U2 = u2; % Compute initial condition; save it in U
]s<[D$ <, ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
o~`/_+ w=2*pi*n./T;
yD zc<p\` g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
EV]1ml k$ L=4; % length of evoluation to compare with S. Trillo's paper
4h|c<-`>t dz=L/M1; % space step, make sure nonlinear<0.05
{*G9|#[/@ for m1 = 1:1:M1 % Start space evolution
ZrpU <
u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
6^]+[q}3 u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
X%
t1T4 ca1 = fftshift(fft(u1)); % Take Fourier transform
,o86}6Ag ca2 = fftshift(fft(u2));
eA2@Nkw~) c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
$a.JSXyxL c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
g6j?,c|y u2 = ifft(fftshift(c2)); % Return to physical space
,E S0NA u1 = ifft(fftshift(c1));
-t!~%_WCv if rem(m1,J) == 0 % Save output every J steps.
<:+ x+4ru U1 = [U1 u1]; % put solutions in U array
*4\:8 U2=[U2 u2];
s6 uG`F" MN1=[MN1 m1];
LBYMCY z1=dz*MN1'; % output location
+r2+X:#~T end
f6hnTbJ end
d,k!qjf=r hg=abs(U1').*abs(U1'); % for data write to excel
hOjk3
k ha=[z1 hg]; % for data write to excel
y0L_"e/ t1=[0 t'];
(7wc *#} hh=[t1' ha']; % for data write to excel file
M?1Y,5 %dlmwrite('aa',hh,'\t'); % save data in the excel format
y%"{I7!A figure(1)
W+I!q:p4H waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
Ag-(5: figure(2)
(KjoSN(
K waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
n]._uza *#,7d"6W5 非线性超快脉冲耦合的数值方法的Matlab程序 R@1 xt@? <FV1Wz 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
.s?L^Z^ 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
&*M!lxDN 8{^kQ/]'| - YEZ]:" 8V'~UzK % This Matlab script file solves the nonlinear Schrodinger equations
8'HEms % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
3#3n!( % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
G|bT9f$ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
*7uH-u"5d rD*jp6Cl C=1;
h0g8*HY+} M1=120, % integer for amplitude
Wf+cDpK M3=5000; % integer for length of coupler
.]8ZwAs=& N = 512; % Number of Fourier modes (Time domain sampling points)
hNC&T`.-~B dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
h79}qU T =40; % length of time:T*T0.
E>6MeO dt = T/N; % time step
P_F30x( n = [-N/2:1:N/2-1]'; % Index
is?{MJZ_ t = n.*dt;
*3+4[WT0]a ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
; 5*&xz w=2*pi*n./T;
!z\h|wU+ g1=-i*ww./2;
Y`~Ut:fZ g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
0{5w 6 g3=-i*ww./2;
S\CCrje P1=0;
/:cd\A} P2=0;
?tWaI{95I P3=1;
LQ@"Xe]5 P=0;
hZm"t/aKc for m1=1:M1
yl'u'-Zb6 p=0.032*m1; %input amplitude
5?f ^Rz s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
^
gdaa>L s1=s10;
fW?vdYF s20=0.*s10; %input in waveguide 2
d-oMQGOklb s30=0.*s10; %input in waveguide 3
iDpSj!x/_ s2=s20;
pIc#L>{E s3=s30;
tR#OjkvX p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
2R[:]-b %energy in waveguide 1
*IB4[6 p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
=O~_Q- %energy in waveguide 2
w2?3wrP3 p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
H%[eV8 %energy in waveguide 3
.#EFLXs for m3 = 1:1:M3 % Start space evolution
p'Y^X s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
.j ?W>F s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
b!+hH Hv: s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
8=!D$t\3 sca1 = fftshift(fft(s1)); % Take Fourier transform
Lc}LGq! sca2 = fftshift(fft(s2));
n'"/KS+_ sca3 = fftshift(fft(s3));
&5>Kl}7 sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
W~)}xy sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
N"Z{5A sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
,<.V7(|t) s3 = ifft(fftshift(sc3));
`~cqAs}6]Q s2 = ifft(fftshift(sc2)); % Return to physical space
,>:U2% s1 = ifft(fftshift(sc1));
|NlO7aQ>2H end
<;lkUU(WT2 p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
${DUCud,kY p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
(|2t#'m p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
kj Jn2c:y P1=[P1 p1/p10];
QL(n} {.% P2=[P2 p2/p10];
pd?Mf=># P3=[P3 p3/p10];
HVRZ[Y<^ P=[P p*p];
8C40%q.. end
:'Vf
g[Uq figure(1)
td$E/h=3 plot(P,P1, P,P2, P,P3);
<NMEGit 7P} W
* 转自:
http://blog.163.com/opto_wang/