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

tianmen 2011-06-12 18:33

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

计算脉冲在非线性耦合器中演化的Matlab 程序 }x?2txuu  
Ab:+AC5{  
%  This Matlab script file solves the coupled nonlinear Schrodinger equations of H.!\j&4j  
%  soliton in 2 cores coupler. The output pulse evolution plot is shown in Fig.1 of T9-2"M=|<  
%  Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear +o}mV.&1,  
%   pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004 xt X`3=s  
/fC8jdp&  
%fid=fopen('e21.dat','w'); 5<h:kZ"S^g  
N = 128;                       % Number of Fourier modes (Time domain sampling points) E)Cdw%}^  
M1 =3000;              % Total number of space steps `fq#W#Pu  
J =100;                % Steps between output of space `(lD]o{,s  
T =10;                  % length of time windows:T*T0 3 UG UZ  
T0=0.1;                 % input pulse width VK^m]??s_  
MN1=0;                 % initial value for the space output location DY8w\1g"  
dt = T/N;                      % time step t4r%EP|Zt  
n = [-N/2:1:N/2-1]';           % Index i'uSu8$'*  
t = n.*dt;   @ wx  
u10=1.*sech(1*t);              % input to waveguide1 amplitude: power=u10*u10 x\'95qU  
u20=u10.*0.0;                  % input to waveguide 2 ,O 1/|Y  
u1=u10; u2=u20;                 ^y<8 &ZFH  
U1 = u1;   )wfqGkr=m!  
U2 = u2;                       % Compute initial condition; save it in U O <"\G!y~  
ww = 4*n.*n*pi*pi/T/T;         % Square of frequency. Note i^2=-1. 9<-7AN}Z  
w=2*pi*n./T; ,p9>/)l  
g=-i*ww./2;                    % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./T ! ^TCe8  
L=4;                           % length of evoluation to compare with S. Trillo's paper roHJ$~q?  
dz=L/M1;                       % space step, make sure nonlinear<0.05 H.*aVb$  
for m1 = 1:1:M1                                    % Start space evolution XywsjeI4  
   u1 = exp(dz*i*(abs(u1).*abs(u1))).*u1;          % 1st sSolve nonlinear part of NLS P,={ C6*  
   u2 = exp(dz*i*(abs(u2).*abs(u2))).*u2; Y3?)*kz%  
   ca1 = fftshift(fft(u1));                        % Take Fourier transform xw~3x*{  
   ca2 = fftshift(fft(u2)); L_Lhmtm}m  
   c2=exp(g.*dz).*(ca2+i*1*ca1.*dz);               % approximation I9O%/^5^[w  
   c1=exp(g.*dz).*(ca1+i*1*ca2.*dz);               % frequency domain phase shift   p\ _&  
   u2 = ifft(fftshift(c2));                        % Return to physical space <@J0 770  
   u1 = ifft(fftshift(c1)); )6:1`&6  
if rem(m1,J) == 0                                 % Save output every J steps. #Mrc!pT]xy  
    U1 = [U1 u1];                                  % put solutions in U array 4~Jg\@  
    U2=[U2 u2]; i{4J$KT  
    MN1=[MN1 m1]; O7# 8g$ZIv  
    z1=dz*MN1';                                    % output location ){$*<#&H  
  end gfly?)VnF  
end Q ?R3aJ  
hg=abs(U1').*abs(U1');                             % for data write to excel X}_Gk5q*  
ha=[z1 hg];                                        % for data write to excel DW0N}>Gp*  
t1=[0 t'];  -wQ@z6R  
hh=[t1' ha'];                                      % for data write to excel file U~q2j#pJ  
%dlmwrite('aa',hh,'\t');                           % save data in the excel format W>y &  
figure(1) in#lpDa[  
waterfall(t',z1',abs(U1').*abs(U1'))               % t' is 1xn, z' is 1xm, and U1' is mxn ;U]Ym48  
figure(2) b;I zK'  
waterfall(t',z1',abs(U2').*abs(U2'))               % t' is 1xn, z' is 1xm, and U1' is mxn e^yfoE<7  
^!*nhs%  
非线性超快脉冲耦合的数值方法的Matlab程序 x<\5Jrqt  
I T?~`vi  
在研究脉冲在非线性耦合器中的演变时,我们需要求解非线性偏微分方程组。在如下的论文中,我们提出了一种简洁的数值方法。 这里我们提供给大家用Matlab编写的计算程序。   vX<^x2~9(  
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 pmgPBiU>  
aXh~w<5F  
< %{?Js  
xzz0uk5  
%  This Matlab script file solves the nonlinear Schrodinger equations \IO<V9^L  
%  for 3 cores nonlinear coupler. The output plot is shown in Fig.2 of =;~*YD(%/  
%  Youfa Wang and Wenfeng Wang, “A simple and effective numerical method for nonlinear sr-tZ^d5S?  
%  pulse propagation in N-core optical couplers”, IEEE Photonics Technology lett. Vol.16, No.4, pp1077-1079, 2004 O 4'/C]B 2  
(Q}ByX  
C=1;                           BI+x6S>d  
M1=120,                       % integer for amplitude ErxvGB(2  
M3=5000;                      % integer for length of coupler ,C0D|q4/!.  
N = 512;                      % Number of Fourier modes (Time domain sampling points) fxknfgbg  
dz =3.14159/(sqrt(2.)*C)/M3;  % length of coupler is divided into M3 segments,  make sure nonlinearity<0.05. AwWo,Y399h  
T =40;                        % length of time:T*T0. ,Rdw]O  
dt = T/N;                     % time step : 22)` ;0  
n = [-N/2:1:N/2-1]';          % Index u{LtyDnik  
t = n.*dt;   z^u*e  
ww = 4*n.*n*pi*pi/T/T;        % Square of frequency. Note i^2=-1. t 09-y  
w=2*pi*n./T; o'K= X E  
g1=-i*ww./2; *=X61`0  
g2=-i*ww./2;                  % w=2*pi*f*n./N, f=1/dt=N/T,so w=2*pi*n./TP=0; <kKuis6h  
g3=-i*ww./2; [,sm]/Xlc  
P1=0; Af Y ]i  
P2=0; ?10L *PD@  
P3=1; 1xjWD30  
P=0; bMB*9<c~  
for m1=1:M1                 G124! ^  
p=0.032*m1;                %input amplitude 5Zn:$?7  
s10=p.*sech(p.*t);         %input soliton pulse in waveguide 1 5O[\gd-  
s1=s10; F+)g!NQZ  
s20=0.*s10;                %input in waveguide 2 Egmp8:nZl@  
s30=0.*s10;                %input in waveguide 3 +h@ZnFp3  
s2=s20; `t3w|%La}  
s3=s30; u4h.\ul8%  
p10=dt*(sum(abs(s10').*abs(s10'))-0.5*(abs(s10(N,1)*s10(N,1))+abs(s10(1,1)*s10(1,1))));   Jk;dtLL}4  
%energy in waveguide 1 W/<Lp+p  
p20=dt*(sum(abs(s20').*abs(s20'))-0.5*(abs(s20(N,1)*s20(N,1))+abs(s20(1,1)*s20(1,1))));   {LBL8sG  
%energy in waveguide 2 7n]ukqZ  
p30=dt*(sum(abs(s30').*abs(s30'))-0.5*(abs(s30(N,1)*s30(N,1))+abs(s30(1,1)*s30(1,1))));   ^ddC a  
%energy in waveguide 3 ~DP5Qi  
for m3 = 1:1:M3                                    % Start space evolution Mh]4K" cs  
   s1 = exp(dz*i*(abs(s1).*abs(s1))).*s1;          % 1st step, Solve nonlinear part of NLS Q7-'5s   
   s2 = exp(dz*i*(abs(s2).*abs(s2))).*s2; BvP++,a&Sa  
   s3 = exp(dz*i*(abs(s3).*abs(s3))).*s3; 'm0_pM1:D  
   sca1 = fftshift(fft(s1));                       % Take Fourier transform QL:Qzr[  
   sca2 = fftshift(fft(s2)); >dXB)yl  
   sca3 = fftshift(fft(s3)); d)GR]^=r  
   sc1=exp(g1.*dz).*(sca1+i*C*sca2.*dz);           % 2nd step, frequency domain phase shift   XZT|ID_u"  
   sc2=exp(g2.*dz).*(sca2+i*C*(sca1+sca3).*dz); 'LYN{  
   sc3=exp(g3.*dz).*(sca3+i*C*sca2.*dz); !uP8powO  
   s3 = ifft(fftshift(sc3)); f`YHZ O  
   s2 = ifft(fftshift(sc2));                       % Return to physical space |h & q  
   s1 = ifft(fftshift(sc1)); +2>, -V  
end ySHpN>U  
   p1=dt*(sum(abs(s1').*abs(s1'))-0.5*(abs(s1(N,1)*s1(N,1))+abs(s1(1,1)*s1(1,1)))); }=A+W2D  
   p2=dt*(sum(abs(s2').*abs(s2'))-0.5*(abs(s2(N,1)*s2(N,1))+abs(s2(1,1)*s2(1,1)))); 08/Tk+  
   p3=dt*(sum(abs(s3').*abs(s3'))-0.5*(abs(s3(N,1)*s3(N,1))+abs(s3(1,1)*s3(1,1)))); +wfZFJ:1l  
   P1=[P1 p1/p10]; ; W$.>*O  
   P2=[P2 p2/p10]; x"A\ Z-xxz  
   P3=[P3 p3/p10]; b^A7R{G7  
   P=[P p*p]; Zt}b}Bz  
end -.K'rW  
figure(1) pm2]  
plot(P,P1, P,P2, P,P3); *Ag3qnY  
}(oWXwFb&W  
转自:http://blog.163.com/opto_wang/
ciomplj 2014-06-22 22:57
谢谢哈~!~
查看本帖完整版本: [-- 求解光孤子或超短脉冲耦合方程的Matlab程序 --] [-- top --]

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