首页 -> 登录 -> 注册 -> 回复主题 -> 发表主题
光行天下 -> MATLAB,SCILAB,Octave,Spyder -> 求解光孤子或超短脉冲耦合方程的Matlab程序 [点此返回论坛查看本帖完整版本] [打印本页]

tianmen 2011-06-12 18:33

求解光孤子或超短脉冲耦合方程的Matlab程序

计算脉冲在非线性耦合器中演化的Matlab 程序 9"1=um=  
~e,K  
%  This Matlab script file solves the coupled nonlinear Schrodinger equations of V_v+i c^  
%  soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of 2fc+PE  
%  Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear yJqDB$0  
%   pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004 6rG7/  
Yu&\a?]\2  
%fid=fopen('e21.dat','w'); P&5vVA6K7  
N = 128;                       % Number of Fourier modes (Time domain sampling points) R*LPwJuv  
M1 =3000;              % Total number of space steps _3f/lG?&-  
J =100;                % Steps between output of space F/A)2 H_  
T =10;                  % length of time windows:T*T0 WRAv>s9  
T0=0.1;                 % input pulse width ^dxy%*Z/  
MN1=0;                 % initial value for the space output location T?u*ey~Tv  
dt = T/N;                      % time step +U<Ae^V  
n = [-N/2:1:N/2-1]';           % Index DX3jE p2  
t = n.*dt;   MfLus40;n  
u10=1.*sech(1*t);              % input to waveguide1 amplitude: power=u10*u10 aG@GJ@w  
u20=u10.*0.0;                  % input to waveguide 2 l`0JL7  
u1=u10; u2=u20;                 G~*R6x2g  
U1 = u1;   436SIh  
U2 = u2;                       % Compute initial condition; save it in U r`u 9MJ*  
ww = 4*n.*n*pi*pi/T/T;         % Square of frequency. Note i^2=-1. 5HvYy *B/  
w=2*pi*n./T; {EU]\Mp0j  
g=-i*ww./2;                    % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T Mwj7*pxUh  
L=4;                           % length of evoluation to compare with S. Trillo's paper p<@+0Uw2  
dz=L/M1;                       % space step, make sure nonlinear<0.05 aM8z_j!!u  
for m1 = 1:1:M1                                    % Start space evolution l`JKQk   
   u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1;          % 1st sSolve nonlinear part of NLS <_bGV  
   u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2; K~5(j{Kb8  
   ca1 = fftshift(fft(u1));                        % Take Fourier transform )5;|mV  
   ca2 = fftshift(fft(u2)); ?PB}2*R  
   c2=exp(g.*dz).*(ca2+i*1*ca1.*dz);               % approximation dwzk+@]8  
   c1=exp(g.*dz).*(ca1+i*1*ca2.*dz);               % frequency domain phase shift   u8y('\(  
   u2 = ifft(fftshift(c2));                        % Return to physical space a5@lWpQsV  
   u1 = ifft(fftshift(c1)); "bO]AG  
if rem(m1,J) == 0                                 % Save output every J steps. _@|_`5W  
    U1 = [U1 u1];                                  % put solutions in U array 0b,{4DOD  
    U2=[U2 u2]; Gn10)Uf8X  
    MN1=[MN1 m1]; Rg~[X5  
    z1=dz*MN1';                                    % output location *(*XNd||  
  end bV@5B#] 2R  
end i2Gh!5]f  
hg=abs(U1').*abs(U1');                             % for data write to excel hM(Hq4ed,  
ha=[z1 hg];                                        % for data write to excel \WVY@eB  
t1=[0 t']; n^epC>a"b  
hh=[t1' ha'];                                      % for data write to excel file $:DhK  
%dlmwrite('aa',hh,'\t');                           % save data in the excel format rIH+X2 x  
figure(1) I)G.tJZ e  
waterfall(t',z1',abs(U1').*abs(U1'))               % t' is 1xn, z' is 1xm, and U1' is mxn G&0JK ,Y  
figure(2) hA"z0Fszh  
waterfall(t',z1',abs(U2').*abs(U2'))               % t' is 1xn, z' is 1xm, and U1' is mxn #xrE^Txh  
(W`=`]!  
非线性超快脉冲耦合的数值方法的Matlab程序 ve=1y)  
lCK:5$ z0  
在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。   A)^A2xZQ  
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 !P_'n  
N%?8Bm~dP  
YH!` uU(Lh  
l)1ySX&BU  
%  This Matlab script file solves the nonlinear Schrodinger equations ,rQPs  
%  for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of > Gxu8,_;  
%  Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear /lvH p  
%  pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004 ;\+A6(GX{  
ga91#NWgK  
C=1;                           C? b_E  
M1=120,                       % integer for amplitude Tq >?.bq9  
M3=5000;                      % integer for length of coupler \6Hu&WHy  
N = 512;                      % Number of Fourier modes (Time domain sampling points) %G~%:uJ5  
dz =3.14159/(sqrt(2.)*C)/M3;  % length of coupler is divided into M3 segments,  make sure nonlinearity<0.05. en gh3TZC  
T =40;                        % length of time:T*T0. zd [cp@  
dt = T/N;                     % time step ~E7=c3:"  
n = [-N/2:1:N/2-1]';          % Index O7I|<H/gVE  
t = n.*dt;   P1QGfp0-J  
ww = 4*n.*n*pi*pi/T/T;        % Square of frequency. Note i^2=-1. ^`!EpO>k9  
w=2*pi*n./T; #EU x1II  
g1=-i*ww./2; Ibl==Irk  
g2=-i*ww./2;                  % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0; uI[lrMQYa  
g3=-i*ww./2; -U_<:  
P1=0; })r[q sv  
P2=0; @AkD-}^[  
P3=1; 30/(  
P=0; Rs%6O|u7  
for m1=1:M1                 kv3jbSKCT  
p=0.032*m1;                %input amplitude )u'("  
s10=p.*sech(p.*t);         %input soliton pulse in waveguide 1 8/E?3a_g-  
s1=s10; -{fbZk&A  
s20=0.*s10;                %input in waveguide 2 7":0CU% %  
s30=0.*s10;                %input in waveguide 3 =zW.~(c{  
s2=s20; o %tvwv  
s3=s30; +#y[sKa  
p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));   $ V"7UA22  
%energy in waveguide 1 ;HaG-c</  
p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));   *tT }y(M  
%energy in waveguide 2 n ZM|8  
p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));   Iih~rWJ  
%energy in waveguide 3 &wZ:$lK#o  
for m3 = 1:1:M3                                    % Start space evolution 5 lC"10  
   s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1;          % 1st step, Solve nonlinear part of NLS ~?{@0,$  
   s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2; TNV#   
   s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3; Mzxy'U V  
   sca1 = fftshift(fft(s1));                       % Take Fourier transform hzc2c.gcF  
   sca2 = fftshift(fft(s2)); u37@9  
   sca3 = fftshift(fft(s3)); b-+iL  
   sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz);           % 2nd step, frequency domain phase shift   =lG5Kc{B  
   sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz); rT ~qoA\  
   sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz); ,*V{g pC7  
   s3 = ifft(fftshift(sc3));  g=:C/>g  
   s2 = ifft(fftshift(sc2));                       % Return to physical space IXf@YV  
   s1 = ifft(fftshift(sc1)); <H~  (iQ  
end 3u8HF-  
   p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1)))); o^},L?  
   p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1)))); A_@#V)D2  
   p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1)))); p_ QL{gn  
   P1=[P1 p1/p10]; '5eW"HGU]`  
   P2=[P2 p2/p10]; fF8g3|p:  
   P3=[P3 p3/p10]; eW+z@\d9Gz  
   P=[P p*p]; uU>Bun  
end ([ xYOxcp5  
figure(1) jfHVXu^M  
plot(P,P1, P,P2, P,P3); 8\t~ *@"  
m`-{ V<(M  
转自:http://blog.163.com/opto_wang/
ciomplj 2014-06-22 22:57
谢谢哈~!~
查看本帖完整版本: [-- 求解光孤子或超短脉冲耦合方程的Matlab程序 --] [-- top --]

Copyright © 2005-2026 光行天下 蜀ICP备06003254号-1 网站统计