计算脉冲在非线性耦合器中演化的Matlab 程序 4d
G- --`LP[ll % This Matlab script file solves the coupled nonlinear Schrodinger equations of
&o@5%Rz2/ % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of
9`xFZMd31A % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
>;v0zE % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
N RSse" 03WRj+w %fid=fopen('e21.dat','w');
~4MjJKzA N = 128; % Number of Fourier modes (Time domain sampling points)
"n }fEVJ, M1 =3000; % Total number of space steps
]a#]3(o]} J =100; % Steps between output of space
tcEf
~|3 T =10; % length of time windows:T*T0
hX%v`8 T0=0.1; % input pulse width
ddDJXk)!0 MN1=0; % initial value for the space output location
Az9J{) dt = T/N; % time step
;}~Bv<# n = [-N/2:1:N/2-1]'; % Index
K)UOx#xe1 t = n.*dt;
&W+G{W{3 u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10
Ko|xEz= u20=u10.*0.0; % input to waveguide 2
P=[x!}.I u1=u10; u2=u20;
jnzz~: U1 = u1;
w9<FX>@ U2 = u2; % Compute initial condition; save it in U
OCO,-( ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
t0H=NUP8 w=2*pi*n./T;
+1jqCW g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T
h$ iyclX L=4; % length of evoluation to compare with S. Trillo's paper
_8pkejg dz=L/M1; % space step, make sure nonlinear<0.05
TL{pc=eBo for m1 = 1:1:M1 % Start space evolution
lkWeQ)V u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS
7TPLVa=hO u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2;
*2
$m>N ca1 = fftshift(fft(u1)); % Take Fourier transform
"rDzrz ca2 = fftshift(fft(u2));
[I<'E
LX c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation
q\y# c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift
T>Rf?%o u2 = ifft(fftshift(c2)); % Return to physical space
1qKxg u1 = ifft(fftshift(c1));
sFM>gG if rem(m1,J) == 0 % Save output every J steps.
S%s|P=u U1 = [U1 u1]; % put solutions in U array
'A(-MTd% U2=[U2 u2];
m\Fb , MN1=[MN1 m1];
Ldj^O9p( z1=dz*MN1'; % output location
&R FM
d= end
us,,W(q end
C\2 >7 hg=abs(U1').*abs(U1'); % for data write to excel
xiOrk ha=[z1 hg]; % for data write to excel
2td|8vDA t1=[0 t'];
="w8U' hh=[t1' ha']; % for data write to excel file
VmH_0IM^6 %dlmwrite('aa',hh,'\t'); % save data in the excel format
aco}pXz figure(1)
lyH X#] waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn
}Oh'YX#[ figure(2)
9 c5G6n0 waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn
=']}; 8j+:s\ 非线性超快脉冲耦合的数值方法的Matlab程序 19w,'}CGk sEJ;t0.LX 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的
论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。
J (&M<<% 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
ny_ kr`$42 OG?j6qhpl zmfRZ!Eh I%Po/+|+ % This Matlab script file solves the nonlinear Schrodinger equations
':2*+ % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of
. I&)MZ>n % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear
g9weJ6@}M % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
]^6y NtLK si!9Gz; C=1;
JU=\]E@8c M1=120, % integer for amplitude
zTBi{KrZ M3=5000; % integer for length of coupler
{Fp`l\, N = 512; % Number of Fourier modes (Time domain sampling points)
Vh.;p.!e dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05.
;$tv8%_L[ T =40; % length of time:T*T0.
!%RJC,X dt = T/N; % time step
u388Wj
n = [-N/2:1:N/2-1]'; % Index
L3=YlX`UL t = n.*dt;
LY88;*:S ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1.
zr; Y1Xt4 w=2*pi*n./T;
71<PEawL g1=-i*ww./2;
lfpt:5a9& g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0;
Eagmafu g3=-i*ww./2;
tp0!,ne* P1=0;
<;,S"e P2=0;
N} x/&e P3=1;
&b@!DAwAJ P=0;
qvfAG 0p for m1=1:M1
3e!Yu.q: p=0.032*m1; %input amplitude
Puth8$ s10=p.*sech(p.*t); %input soliton pulse in waveguide 1
[>M*_1F s1=s10;
djy: s20=0.*s10; %input in waveguide 2
WP%{{zR$ s30=0.*s10; %input in waveguide 3
ahi57r[ s2=s20;
[;IDTo!<> s3=s30;
X\3,NR, p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));
kTiPZZI %energy in waveguide 1
=4M.QA@lI! p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));
rMXOwkE %energy in waveguide 2
ej"o?1l@ p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));
}KaCf,O %energy in waveguide 3
]g8i>,G for m3 = 1:1:M3 % Start space evolution
B
)1<`nJA s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS
z7t'6Fy9' s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2;
@^:7UI_ s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3;
5;K-,"UQ sca1 = fftshift(fft(s1)); % Take Fourier transform
BudWbZ5>Ep sca2 = fftshift(fft(s2));
JW% /^' sca3 = fftshift(fft(s3));
u.pKK
sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift
5}d/8tS sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz);
HV$9b~( sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz);
lEyG9Xvi s3 = ifft(fftshift(sc3));
q(jkit~`A s2 = ifft(fftshift(sc2)); % Return to physical space
9#EHXgz s1 = ifft(fftshift(sc1));
az\<sWb# end
P"V{y|2 p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1))));
I4o=6ts p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1))));
B.Zm$JZ: p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1))));
[ n0##/ P1=[P1 p1/p10];
fOK+DT~ P2=[P2 p2/p10];
e$ XY\{
P3=[P3 p3/p10];
!0!U01SWa P=[P p*p];
,{uW8L end
"J8;4p figure(1)
ySixYt plot(P,P1, P,P2, P,P3);
#4P3xa KTLbqSS\ 转自:
http://blog.163.com/opto_wang/