| tianmen |
2011-06-12 18:33 |
求解光孤子或超短脉冲耦合方程的Matlab程序
计算脉冲在非线性耦合器中演化的Matlab 程序 &Z#g/Hc M qFuZg % This Matlab script file solves the coupled nonlinear Schrodinger equations of EcU}ErN % soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of 2E;UHR % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear tg.[.vKs % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004 {OH"d T}M!A| %fid=fopen('e21.dat','w'); A )tGB& N = 128; % Number of Fourier modes (Time domain sampling points) fH}#.vy M1 =3000; % Total number of space steps sWa`-gc J =100; % Steps between output of space &,JrhMr\ T =10; % length of time windows:T*T0 1-.6psE T0=0.1; % input pulse width 7vF+Di(B MN1=0; % initial value for the space output location bXmX@A$#Io dt = T/N; % time step lpvZ[^G n = [-N/2:1:N/2-1]'; % Index *QH@c3vUe\ t = n.*dt; MZZEqsD5[ u10=1.*sech(1*t); % input to waveguide1 amplitude: power=u10*u10 WzDL(~m+Z u20=u10.*0.0; % input to waveguide 2 a9}7K/Y=d u1=u10; u2=u20; CD]"Q1
t} U1 = u1; )O;6S$z9Y U2 = u2; % Compute initial condition; save it in U Wl\.*^`k ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1. :2ILN.& w=2*pi*n./T; 8eGq.+5G g=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T ~
HN L=4; % length of evoluation to compare with S. Trillo's paper $F2A dz=L/M1; % space step, make sure nonlinear<0.05 NGIt~"e7R4 for m1 = 1:1:M1 % Start space evolution ;&RBg+Pr u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1; % 1st sSolve nonlinear part of NLS `#Z=cq^_ u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2; =r:(ga ca1 = fftshift(fft(u1)); % Take Fourier transform !8~A` ca2 = fftshift(fft(u2)); b\^X1eo
c2=exp(g.*dz).*(ca2+i*1*ca1.*dz); % approximation (
y0 c1=exp(g.*dz).*(ca1+i*1*ca2.*dz); % frequency domain phase shift !Pd@0n4 u2 = ifft(fftshift(c2)); % Return to physical space &6deds
u1 = ifft(fftshift(c1)); FabgJu if rem(m1,J) == 0 % Save output every J steps. S8>1l?UH U1 = [U1 u1]; % put solutions in U array w5Lev}Rb U2=[U2 u2]; N)CM^$(T| MN1=[MN1 m1]; B6UTooj z1=dz*MN1'; % output location 2PZ#w(An& end r`-=<@[ end Wz{,N07Q#{ hg=abs(U1').*abs(U1'); % for data write to excel _Fe%Ek1Yy ha=[z1 hg]; % for data write to excel [A\DuJx t1=[0 t']; (r*"}"ZG hh=[t1' ha']; % for data write to excel file S@4p.NMU %dlmwrite('aa',hh,'\t'); % save data in the excel format ^-nL!>FYY figure(1) `s8*n(\h waterfall(t',z1',abs(U1').*abs(U1')) % t' is 1xn, z' is 1xm, and U1' is mxn q8 &\;GK| figure(2) %/; *Ewwb waterfall(t',z1',abs(U2').*abs(U2')) % t' is 1xn, z' is 1xm, and U1' is mxn FT8<a }o 9t8NK{ 非线性超快脉冲耦合的数值方法的Matlab程序 2Sgv D*0[7:NSO 在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。 db*yA@2Lg 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 "~2SHM@q |-l9 Z e92,@ -sqd?L.p % This Matlab script file solves the nonlinear Schrodinger equations w 3kX!%a: % for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of K&4FFZ % Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear 0q6xXNAX % pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004 {q!GTO zu_bno! C=1; z&wJ"[nOC M1=120, % integer for amplitude utzf7?nIS M3=5000; % integer for length of coupler E[NszM[P N = 512; % Number of Fourier modes (Time domain sampling points) u(W>HVEG dz =3.14159/(sqrt(2.)*C)/M3; % length of coupler is divided into M3 segments, make sure nonlinearity<0.05. HkPdqNC& T =40; % length of time:T*T0. b9R0"w!ml
dt = T/N; % time step joA>-k04 n = [-N/2:1:N/2-1]'; % Index :lU#Dm] t = n.*dt; R :*1Y\o( ww = 4*n.*n*pi*pi/T/T; % Square of frequency. Note i^2=-1. `(uN_zvH w=2*pi*n./T; 6c6w w" g1=-i*ww./2; 9y}/ G g2=-i*ww./2; % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0; XOL_vS24 g3=-i*ww./2; U6?3 z P1=0; A$3ll|%j P2=0; O$ARk+ P3=1; #;0F-pt P=0; f4;V7DJ for m1=1:M1 Vd;NT$S$ p=0.032*m1; %input amplitude RF[Uy?es s10=p.*sech(p.*t); %input soliton pulse in waveguide 1 +[Izz~_p s1=s10; ~K@p`CRbV s20=0.*s10; %input in waveguide 2 K-b`KcX s30=0.*s10; %input in waveguide 3 Hb3..o: s2=s20; oH(a*i s3=s30; oD3]2o / p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1)))); cO8yu`4!e %energy in waveguide 1 Df@b;-E p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1)))); $9@3dM*E?Z %energy in waveguide 2 &3Ry0?RET p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1)))); Nd
He:: %energy in waveguide 3 cTja<*W^xv for m3 = 1:1:M3 % Start space evolution 0nPg`@e . s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1; % 1st step, Solve nonlinear part of NLS weMufT s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2; 4axuE] s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3; c?*x2Vk sca1 = fftshift(fft(s1)); % Take Fourier transform
w~~[0e+E sca2 = fftshift(fft(s2)); BsR3$ sca3 = fftshift(fft(s3)); q*!Vyk sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz); % 2nd step, frequency domain phase shift =5O&4G`} sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz); kl|m @Nxp sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz); rRXF@ s3 = ifft(fftshift(sc3)); vt#&YXu{A s2 = ifft(fftshift(sc2)); % Return to physical space JMfv|>= s1 = ifft(fftshift(sc1)); gm$<U9L\v end +^q-v- p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1)))); C:_-F3|]cJ p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1)))); z
$iI p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1)))); _ xM}*_<VP P1=[P1 p1/p10]; ]P2Wa
P2=[P2 p2/p10]; ikb;,Js P3=[P3 p3/p10]; m'KEN<)s P=[P p*p]; zG7y$\A end \;Sl5*kr figure(1) L*6>S_l[ plot(P,P1, P,P2, P,P3); n){u!z)Al )&[ol9+\ 转自:http://blog.163.com/opto_wang/
|
|