| tianmen |
2011-06-12 18:33 |
求解光孤子或超短脉冲耦合方程的Matlab程序
计算脉冲在非线性耦合器中演化的Matlab 程序 ix_&os]L_ #+ Y%Bxf % This Matlab script file solves the coupled nonlinear Schrodinger equations of 64qqJmG3 % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of #H]c/ % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear `b KJ % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004 vcC" b#(X+I %fid=fopen('e21.dat','w'); fXSuJ<G N = 128; % Number of Fourier modes (Time domain sampling points) NpH9},1i M1 =3000; % Total number of space steps &N*l ?7( J =100; % Steps between output of space ! n<SpW; T =10; % length of time windows:T*T0 *RmD%[f T0=0.1; % input pulse width 'iU+mRLp MN1=0; % initial value for the space output location }ag;yf; dt = T/N; % time step #wZbG|% n = [-N/2:1:N/2-1]'; % Index +E']&v$ t = n.*dt; aUi^7;R&< u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10 L;=3n[^x u20=u10.*0.0; % input to waveguide 2 :Bi 4z( u1=u10; u2=u20; 1}~ZsrF U1 = u1; bPIo9clq U2 = u2; % Compute initial condition; save it in U 2^qJ'<2]M ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1. n-{.7 w=2*pi*n./T; +k V$ @qH g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T b!qlucAeE L=4; % length of evoluation to compare with S. Trillo's paper `{NbMc\
] dz=L/M1; % space step, make sure nonlinear<0.05 a4mRu|x for m1 = 1:1:M1 % Start space evolution kDG?/j90D u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS VAp 1{ u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2; 'Hsd7Dpi} ca1 = fftshift(fft(u1)); % Take Fourier transform ,<$rSvMfg ca2 = fftshift(fft(u2)); h!`KX2~ c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation >DAi-`e c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift U,8mYv2| u2 = ifft(fftshift(c2)); % Return to physical space _zkTx7H u1 = ifft(fftshift(c1)); Z&n#*rQ7[ if rem(m1,J) == 0 % Save output every J steps. iO"ZtkeNr U1 = [U1 u1]; % put solutions in U array Lb?0< U2=[U2 u2]; b#*"eZj MN1=[MN1 m1]; ,ZVhL* " z1=dz*MN1'; % output location 8gG;A8 end =
toU?:. end xyHv7u%* hg=abs(U1').*abs(U1'); % for data write to excel _p?s[r* ha=[z1 hg]; % for data write to excel g>g*1oS t1=[0 t']; U?ZWDr"*`w hh=[t1' ha']; % for data write to excel file zYM0?O8pJ~ %dlmwrite('aa',hh,'\t'); % save data in the excel format X<H{ figure(1) ANfy+@ waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn eh8lPTKil figure(2) )x35
waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn c<sq0('` q{+}0!o 非线性超快脉冲耦合的数值方法的Matlab程序 pb G5y7 Gz4LjMQ
& 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。 53?Ati\Y) 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 Ap 3B' Zy|u5J 03_M+lv cqT%6Si % This Matlab script file solves the nonlinear Schrodinger equations wxN&k$`a % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of ~%h&ELSw % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear 1kD1$5 % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004 T-]UAN"O ge1U1o C=1; NErvX/qK M1=120, % integer for amplitude N,.awA{ M3=5000; % integer for length of coupler ,!X:wY}dW N = 512; % Number of Fourier modes (Time domain sampling points) 1tTY)Evf dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05. ?A04qk T =40; % length of time:T*T0. }h* j{b, dt = T/N; % time step SjIDzNI5 n = [-N/2:1:N/2-1]'; % Index jUDE)~h t = n.*dt; hLVgP&/E ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1. k=G c#SD5_ w=2*pi*n./T; W@i|=xS? g1=-i*ww./2; 'v=BAY=Ef g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0; DiZ;FHnaG? g3=-i*ww./2; rV2>;FG P1=0; g4{0 P2=0; a54S,}| P3=1; Pn L?zae P=0; rbs&A{i for m1=1:M1 j,Qb'|f5 p=0.032*m1; %input amplitude O&}R s10=p.*sech(p.*t); %input soliton pulse in waveguide 1 =h|7bYLy s1=s10; AS0mMHJk s20=0.*s10; %input in waveguide 2 SR`A]EC(V s30=0.*s10; %input in waveguide 3 =LEzcq>XO s2=s20; (`u+(M!^ s3=s30; 2sVDv@2 p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1)))); 2/Y e<.# %energy in waveguide 1 44KWS~ p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1)))); NRk^Z) %energy in waveguide 2 :9(w~bB9$ p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1)))); .'4@Yp{= %energy in waveguide 3 Xn5LrLM& for m3 = 1:1:M3 % Start space evolution &vIj(e9Y s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS }WF6w+ s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2; XpA|<s s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3; \jS^+Xf?^ sca1 = fftshift(fft(s1)); % Take Fourier transform #-{ljjMQI sca2 = fftshift(fft(s2)); ldc`Y/:{ sca3 = fftshift(fft(s3)); wo$ F_!3u sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift z6h/C{ sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz); gKgdu($NJ sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz); sDu&9+ s3 = ifft(fftshift(sc3)); }uO2x@ s2 = ifft(fftshift(sc2)); % Return to physical space 75A60Uw s1 = ifft(fftshift(sc1)); dEo r+5} end (C%qA<6 p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1)))); 9WHarv2 @ p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1)))); 2P{! n#" p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1)))); :U]Pm:ivTU P1=[P1 p1/p10]; T( k:\z/ P2=[P2 p2/p10]; Zc*#LsQh.` P3=[P3 p3/p10]; V;P*/ke P=[P p*p]; KqNsCT+j end gEq6[G figure(1) @[n%q.|VB plot(P,P1, P,P2, P,P3); |>-0q~ 6+C]rEY/o
转自:http://blog.163.com/opto_wang/
|
|