tianmen |
2011-06-12 18:33 |
求解光孤子或超短脉冲耦合方程的Matlab程序
计算脉冲在非线性耦合器中演化的Matlab 程序 :OvTZ ?\ Zfub+A % This Matlab script file solves the coupled nonlinear Schrodinger equations of (jB_uMuS % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of qGPIKu % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear FW7@7cVoF % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004
*^b<CZd9 wUBug %fid=fopen('e21.dat','w'); &fuJ% N = 128; % Number of Fourier modes (Time domain sampling points) vynchZ+g] M1 =3000; % Total number of space steps Oe:_B/l J =100; % Steps between output of space [j^c&}0 T =10; % length of time windows:T*T0 `L1lGlt T0=0.1; % input pulse width ( [m[< MN1=0; % initial value for the space output location M<"H1>q@ dt = T/N; % time step !>Ru= $9 n = [-N/2:1:N/2-1]'; % Index /6Vn WrN_ t = n.*dt;
ra*(.<& u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10 +`H{ u20=u10.*0.0; % input to waveguide 2 %~A$cc u1=u10; u2=u20; D%NVqk| U1 = u1; 1ZK~i U2 = u2; % Compute initial condition; save it in U voAen&>! ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1. -32?]LN}
w=2*pi*n./T; z3X:.% g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T _onEXrM L=4; % length of evoluation to compare with S. Trillo's paper >4N=P0= dz=L/M1; % space step, make sure nonlinear<0.05 Udbz;^( for m1 = 1:1:M1 % Start space evolution Kgw_c:/' u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS %SSBXWP u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2; f-b#F2I ca1 = fftshift(fft(u1)); % Take Fourier transform loPBHoE3@H ca2 = fftshift(fft(u2)); r=o\!sh[ c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation P:8P>#L c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift ehCZhi~ u2 = ifft(fftshift(c2)); % Return to physical space 6*92I u1 = ifft(fftshift(c1)); +GqV9x 8 if rem(m1,J) == 0 % Save output every J steps. 7,![oY[ U1 = [U1 u1]; % put solutions in U array (#"iZv, U2=[U2 u2]; jJfV_#'N' MN1=[MN1 m1]; M~/R1\'&j z1=dz*MN1'; % output location MH8 Selnv end _x ;fTW0 end b=-LQkcZhK hg=abs(U1').*abs(U1'); % for data write to excel qIIl,!&}A ha=[z1 hg]; % for data write to excel hz8Z)xjJ V t1=[0 t']; HECZZnM hh=[t1' ha']; % for data write to excel file >
l@o\ %dlmwrite('aa',hh,'\t'); % save data in the excel format 9?xc3F2EBD figure(1) ^.f`6 6/ waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn ;0!rq^JG figure(2) 82bOiN15 waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn &InMI#0mV jdF~0#vH 非线性超快脉冲耦合的数值方法的Matlab程序 pd1V8PZSG O)4P)KAO< 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。 EhBYmc"& 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^Jf(NE0Yo AX= 4{b' DY~zi qAF.i^ % This Matlab script file solves the nonlinear Schrodinger equations DE^ @b+6 % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of itg
PG % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear -#ta/*TT: % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004 mq(*4KFWJ2 XtV=Gr8" C=1; l$s8O0-'T M1=120, % integer for amplitude %?7j
Q M3=5000; % integer for length of coupler 9se,c N = 512; % Number of Fourier modes (Time domain sampling points) Qs^RhF\d dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05. Td`0;R'<}c T =40; % length of time:T*T0. sP+ZE>7 dt = T/N; % time step 3;h%mkKQ+ n = [-N/2:1:N/2-1]'; % Index A]FjV~PB t = n.*dt; ~e)`D nJ ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1. gZ^NdDBO w=2*pi*n./T; ,X2CV INb} g1=-i*ww./2; %Z"I=;=nxI g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0; l{7q( g3=-i*ww./2; #)r
P1=0; MJ)aY2 P2=0; 9z:P#=Q: P3=1; iw$n*1M P=0; ua^gG3n0 for m1=1:M1 pd[?TyVK; p=0.032*m1; %input amplitude 9Xu
O\+z s10=p.*sech(p.*t); %input soliton pulse in waveguide 1 *UJ&9rQ s1=s10; \Q5Jg s20=0.*s10; %input in waveguide 2 r3hUa4^97 s30=0.*s10; %input in waveguide 3 j/FFxlFNL s2=s20; !P6\-. s3=s30; m R3km1T p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1)))); b\U p(] %energy in waveguide 1 "[*W=6m0 p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1)))); (RL5L=,u %energy in waveguide 2 uH 6QK\ p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1)))); k365.nc %energy in waveguide 3 16p$>a<6 for m3 = 1:1:M3 % Start space evolution ;LBq! s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS whzV7RT s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2; #_,
l7q8U s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3; 22|a~"Z sca1 = fftshift(fft(s1)); % Take Fourier transform V ?10O sca2 = fftshift(fft(s2)); dh~+0FZ{A sca3 = fftshift(fft(s3)); )T=cd sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift "Zh6j)[o sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz); f/r@9\x sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz); 4;*o}E s3 = ifft(fftshift(sc3)); K'`N(WiL s2 = ifft(fftshift(sc2)); % Return to physical space M=57 d7 s1 = ifft(fftshift(sc1)); hY?x14m$3 end c&+p{hH+ p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1)))); kc3dWWPe p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1)))); -L&FguoVB p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1)))); <V}^c/c! P1=[P1 p1/p10]; 9K>$ P2=[P2 p2/p10]; O;NQJ$^bI P3=[P3 p3/p10]; !;YmLJk;hN P=[P p*p]; eQ}o;vJN end A&$oiLc figure(1) f2sv$#' plot(P,P1, P,P2, P,P3); l>i<J1 {jOCz1J 转自:http://blog.163.com/opto_wang/
|
|