计算脉冲在非线性耦合器中演化的Matlab 程序 i? a]v 5 0~-+5V % This Matlab script file solves the coupled nonlinear Schrodinger equations of
D@3|nS % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
X!"y>J % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
U?}Ma f % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
P"~B2__* EdU3k'z$ %fid=fopen('e21.dat','w');
!X,S2-}" N = 128; % Number of Fourier modes (Time domain sampling points)
fW\u*dMMZE M1 =3000; % Total number of space steps
-Zw"o> J =100; % Steps between output of space
A,iXiDb3pK T =10; % length of time windows:T*T0
PzF)Vg T0=0.1; % input pulse width
M0]fh5O MN1=0; % initial value for the space output location
%ZxKN ; dt = T/N; % time step
w68qyG|wM n = [-N/2:1:N/2-1]'; % Index
?Jma^ S t = n.*dt;
x^;nfqn| u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
o3`Z@-.G u20=u10.*0.0; % input to waveguide 2
EZ=M^0=Hpf u1=u10; u2=u20;
Oc8+an1m U1 = u1;
3b_#xr- U2 = u2; % Compute initial condition; save it in U
ROfmAc ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
1n5&PNu w=2*pi*n./T;
jALo;PDJ g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
kiECJ@5p L=4; % length of evoluation to compare with S. Trillo's paper
kP| !!N dz=L/M1; % space step, make sure nonlinear<0.05
5<S1,u5 for m1 = 1:1:M1 % Start space evolution
ES+&e/G"ds u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
Z@*Z@]FC u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
\2LCpN ca1 = fftshift(fft(u1)); % Take Fourier transform
.p5*&i7 ca2 = fftshift(fft(u2));
6suc0 c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
]~oM'?&! c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
SHaZ-d u2 = ifft(fftshift(c2)); % Return to physical space
o]FQ)WRB u1 = ifft(fftshift(c1));
<.AIVp if rem(m1,J) == 0 % Save output every J steps.
ar{e<&Bny U1 = [U1 u1]; % put solutions in U array
NN$`n*;l U2=[U2 u2];
hVID~L$ MN1=[MN1 m1];
eFx*lYjA z1=dz*MN1'; % output location
A/.cNen end
G
cbal:q end
$~2Ao[ hg=abs(U1').*abs(U1'); % for data write to excel
vD*KJ3(c ha=[z1 hg]; % for data write to excel
i0R=P[ t1=[0 t'];
l==T3u
r hh=[t1' ha']; % for data write to excel file
Hnaq+ _] %dlmwrite('aa',hh,'\t'); % save data in the excel format
Ne4A figure(1)
6$zUFIk waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
$~j]/ U figure(2)
]f\rB8k|& waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
x
1_(j 0 Hq$h 非线性超快脉冲耦合的数值方法的Matlab程序 ;P{ *'@ ?,!qh 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
VP"L_Um 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
D`gY6wX c[YC}@l%a oDRNM^gz fpqKa r % This Matlab script file solves the nonlinear Schrodinger equations
N$3F4b%+ % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
.c',?[S/vH % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
UOwj"#
% pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
Z<wg` Rw7Q[I5z% C=1;
ND`~|6yb M1=120, % integer for amplitude
-V+fQGZe M3=5000; % integer for length of coupler
vbWX`skU N = 512; % Number of Fourier modes (Time domain sampling points)
>sP;B5S dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
Z2ZS5a T =40; % length of time:T*T0.
`zvYuKQ.} dt = T/N; % time step
xE}q(.] n = [-N/2:1:N/2-1]'; % Index
e5AiIVlv t = n.*dt;
$V+ze*ra ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
](O!6_'d w=2*pi*n./T;
5-sxTp g1=-i*ww./2;
sPhh#VCw{ g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
@U9ov >E g3=-i*ww./2;
[[)HPHSQ P1=0;
%@IR7v~ P2=0;
+yYz ;, \ P3=1;
lKa}Bcd P=0;
#\"5:.H Oz for m1=1:M1
7[K$os5al p=0.032*m1; %input amplitude
M^bujGD s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
sQ_{zOUPh s1=s10;
Nc7YMxk'H s20=0.*s10; %input in waveguide 2
S2Wxf>bt2 s30=0.*s10; %input in waveguide 3
*v&g>Ni s2=s20;
:JOF!Q s3=s30;
t#d~gBe?V p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
[3\}Ca1 %energy in waveguide 1
d6Z;\f7[ p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
'91Ak,cWB %energy in waveguide 2
HID;~Ne p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
uh GL1{ %energy in waveguide 3
| 0&~fY for m3 = 1:1:M3 % Start space evolution
, n+dB2\ s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
KI#hII[Q. s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
OW6i2 >Or s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
Va{`es)hky sca1 = fftshift(fft(s1)); % Take Fourier transform
0R; ;ou sca2 = fftshift(fft(s2));
e}Db-7B_~ sca3 = fftshift(fft(s3));
9 Z4H5!:( sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
]@<O!fS sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
No h*1u* sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
J0{0B=d; s3 = ifft(fftshift(sc3));
BK-{z).) s2 = ifft(fftshift(sc2)); % Return to physical space
{>syZZ,h s1 = ifft(fftshift(sc1));
WyO10yvR end
h nyZXk1| p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
T]0qd^\4w p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
**oN/5 p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
`i<U;?=0' P1=[P1 p1/p10];
n}YRE`>D P2=[P2 p2/p10];
b2 ZKhS8 P3=[P3 p3/p10];
p-;*K(#X P=[P p*p];
g<tr |n end
.)Du
; figure(1)
pvcD
61, plot(P,P1, P,P2, P,P3);
Bl(we/r Id9hC<8$dq 转自:
http://blog.163.com/opto_wang/