环形光波导耦合器件程序.doc_第1页
环形光波导耦合器件程序.doc_第2页
环形光波导耦合器件程序.doc_第3页
环形光波导耦合器件程序.doc_第4页
环形光波导耦合器件程序.doc_第5页
已阅读5页,还剩10页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

10度:%This program calculate the waveguide by a photonic crystal.%For two dimension case.%Only for TM case(Ez,Hx,Hy), in this version试验版本.clear;%tic%Initial parameters and other things.W=0.36; %Normalized frequency 就是能带图中的纵坐标,单位为(a/lamda)%The following parameters are control parameters.WaveGuide=1; %If this program is for Wave Guide? If so, please specify 1.IsMovie=0; %If you want to play movie, please use 1.IsFigure=1; %If it will plot the figures? If so, please specify 1.WantToSeeEp=1; %Do you want to see the distrubution of Ep(TE极化,S极化)? If so, please specify 1.%End of defining control parametersMLatx=11; %How many Lattice cell in x direction.栅格MLaty=11; %How many Lattice cell in y direction.NMlat=21; %The gird number in each Lattice Cell. 每个栅格中包含的fdtd网格个数 %SHOULD BE ODD INTEGER!奇数整数个 if mod(NMlat,2)=0 NMlat=NMlat+1;end %Force it to be a odd integer!NTx=MLatx*NMlat+1; %It is the number of the Grid along x axis.总的fdtd网格坐标点(所以要加1)NTy=MLaty*NMlat+1; %It is the number of the Grid along y axis.if WaveGuide=1 Nrow=5; %The row number of coloumns between the PML boundary and the waveguide.(此处定义,现在还不知所措)endNPML=12; %How many PML layers will be used in our computation.PML的层数NTimeSteps=5000; %Total number of Time StepsMeach=20; %Define the interval for plot figures if IsFigure=1. %This also works for saving intervals.每隔20个时间步显示一次。 R=0.2; %The radius of dielectric columns,ea=11.4; %The dielectric constant of these columns.Zmax=0.8; %The maximum value for z axis when plotting figures.Colormax=2.8; %The maximum value for colormap when plotting figures.%Some constantsmu0=4*pi*1.0e-7; %Epsilon Zero, if using Gauss Unit, it equals to 1.e0=8.85*1e-12; %Mu Zero, if using Gauss Unit, it equals to 1.c=1/sqrt(mu0*e0); %The light speed.factor=mu0/e0; %The factor between conductivity and permeability. %Permeability=Conductivity*factor, in PML.PML中的匹配条件 a=1;%e-6; %The lattice constant.栅格常数。W=W*(2*pi*c/a); %frequency Dx=a/NMlat; %Delta x.dx1/(一个栅格中的网格数)Dy=Dx; %Delta y.Dt=1/sqrt(1/(Dx*Dx)+1/(Dy*Dy)/c; %Time interval%tic%In the following partm we define the dielectric%constants:,定义FDTD中平面波导与空气的介电常数Ep=ones(NTx-1,NTy-1)*e0; %FDTD总的网格中的介质常数,真空。Ep_cell=ones(NMlat,NMlat)*e0;%每个栅格中的fdtd介电常数,真空。x=-(NMlat-1)/2*Dx:Dx:(NMlat-1)/2*Dx;%先对栅格操作,然后进行repmat,复制并平铺阵列。X,Y=meshgrid(x);%把x方向上的向量拓展为X,Y两个矩阵。X=X;Y=Y;flag=find(sqrt(X.2+Y.2)MLatx*NMlat) right=MLatx*NMlat; end Ep(left:right,j)=e0*ea; j=j-1; end j=(MLaty*NMlat+1)/2; for i=1:cot(angle):(MLatx*NMlat+1)/2+length+(NMlat+1)/2 k=round(i); left=(MLaty*NMlat+1)/2-(NMlat+1)/2-length+i-1; %常数可修改 right=left+length+55; %常数可修改 if(rightMLatx*NMlat) right=MLatx*NMlat; end Ep(left:right,j)=e0*ea; j=j+1; endend%tocif WantToSeeEp=1 x=0:Dx:(NMlat*MLatx-1)*Dx; x=x-(NMlat*MLatx-1)*Dx/2; y=0:Dy:(NMlat*MLaty-1)*Dy; y=y-(NMlat*MLaty-1)*Dy/2; X,Y=meshgrid(x,y); X=X; Y=Y; surf(X,Y,Ep/e0); shading interp; view(0,90); axis(min(x), max(x),min(y), max(y) axis off; disp(Press any key to continue.); pauseend%End of defining the Ep.15度:%This program calculate the waveguide by a photonic crystal.%For two dimension case.%Only for TM case(Ez,Hx,Hy), in this version试验版本.clear;%tic%Initial parameters and other things.W=0.36; %Normalized frequency 就是能带图中的纵坐标,单位为(a/lamda)%The following parameters are control parameters.WaveGuide=1; %If this program is for Wave Guide? If so, please specify 1.IsMovie=0; %If you want to play movie, please use 1.IsFigure=1; %If it will plot the figures? If so, please specify 1.WantToSeeEp=1; %Do you want to see the distrubution of Ep(TE极化,S极化)? If so, please specify 1.%End of defining control parametersMLatx=11; %How many Lattice cell in x direction.栅格MLaty=11; %How many Lattice cell in y direction.NMlat=21; %The gird number in each Lattice Cell. 每个栅格中包含的fdtd网格个数 %SHOULD BE ODD INTEGER!奇数整数个 if mod(NMlat,2)=0 NMlat=NMlat+1;end %Force it to be a odd integer!NTx=MLatx*NMlat+1; %It is the number of the Grid along x axis.总的fdtd网格坐标点(所以要加1)NTy=MLaty*NMlat+1; %It is the number of the Grid along y axis.if WaveGuide=1 Nrow=5; %The row number of coloumns between the PML boundary and the waveguide.(此处定义,现在还不知所措)endNPML=12; %How many PML layers will be used in our computation.PML的层数NTimeSteps=5000; %Total number of Time StepsMeach=20; %Define the interval for plot figures if IsFigure=1. %This also works for saving intervals.每隔20个时间步显示一次。 R=0.2; %The radius of dielectric columns,ea=11.4; %The dielectric constant of these columns.Zmax=0.8; %The maximum value for z axis when plotting figures.Colormax=2.8; %The maximum value for colormap when plotting figures.%Some constantsmu0=4*pi*1.0e-7; %Epsilon Zero, if using Gauss Unit, it equals to 1.e0=8.85*1e-12; %Mu Zero, if using Gauss Unit, it equals to 1.c=1/sqrt(mu0*e0); %The light speed.factor=mu0/e0; %The factor between conductivity and permeability. %Permeability=Conductivity*factor, in PML.PML中的匹配条件 a=1;%e-6; %The lattice constant.栅格常数。W=W*(2*pi*c/a); %frequency Dx=a/NMlat; %Delta x.dx1/(一个栅格中的网格数)Dy=Dx; %Delta y.Dt=1/sqrt(1/(Dx*Dx)+1/(Dy*Dy)/c; %Time interval%tic%In the following partm we define the dielectric%constants:,定义FDTD中平面波导与空气的介电常数Ep=ones(NTx-1,NTy-1)*e0; %FDTD总的网格中的介质常数,真空。Ep_cell=ones(NMlat,NMlat)*e0;%每个栅格中的fdtd介电常数,真空。x=-(NMlat-1)/2*Dx:Dx:(NMlat-1)/2*Dx;%先对栅格操作,然后进行repmat,复制并平铺阵列。X,Y=meshgrid(x);%把x方向上的向量拓展为X,Y两个矩阵。X=X;Y=Y;flag=find(sqrt(X.2+Y.2)MLatx*NMlat) right=MLatx*NMlat; end Ep(left:right,j)=e0*ea; j=j-1; end j=(MLaty*NMlat+1)/2; for i=1:cot(angle):(MLatx*NMlat+1)/2+length+(NMlat+1)/2 k=round(i); left=(MLaty*NMlat+1)/2-(NMlat+1)/2-length+i-1; %常数可修改 right=left+length+40; %常数可修改 if(rightMLatx*NMlat) right=MLatx*NMlat; end Ep(left:right,j)=e0*ea; j=j+1; endend%tocif WantToSeeEp=1 x=0:Dx:(NMlat*MLatx-1)*Dx; x=x-(NMlat*MLatx-1)*Dx/2; y=0:Dy:(NMlat*MLaty-1)*Dy; y=y-(NMlat*MLaty-1)*Dy/2; X,Y=meshgrid(x,y); X=X; Y=Y; surf(X,Y,Ep/e0); shading interp; view(0,90); axis(min(x), max(x),min(y), max(y) axis off; disp(Press any key to continue.); pauseend%End of defining the Ep.20度:%This program calculate the waveguide by a photonic crystal.%For two dimension case.%Only for TM case(Ez,Hx,Hy), in this version试验版本.clear;%tic%Initial parameters and other things.W=0.36; %Normalized frequency 就是能带图中的纵坐标,单位为(a/lamda)%The following parameters are control parameters.WaveGuide=1; %If this program is for Wave Guide? If so, please specify 1.IsMovie=0; %If you want to play movie, please use 1.IsFigure=1; %If it will plot the figures? If so, please specify 1.WantToSeeEp=1; %Do you want to see the distrubution of Ep(TE极化,S极化)? If so, please specify 1.%End of defining control parametersMLatx=11; %How many Lattice cell in x direction.栅格MLaty=11; %How many Lattice cell in y direction.NMlat=21; %The gird number in each Lattice Cell. 每个栅格中包含的fdtd网格个数 %SHOULD BE ODD INTEGER!奇数整数个 if mod(NMlat,2)=0 NMlat=NMlat+1;end %Force it to be a odd integer!NTx=MLatx*NMlat+1; %It is the number of the Grid along x axis.总的fdtd网格坐标点(所以要加1)NTy=MLaty*NMlat+1; %It is the number of the Grid along y axis.if WaveGuide=1 Nrow=5; %The row number of coloumns between the PML boundary and the waveguide.(此处定义,现在还不知所措)endNPML=12; %How many PML layers will be used in our computation.PML的层数NTimeSteps=5000; %Total number of Time StepsMeach=20; %Define the interval for plot figures if IsFigure=1. %This also works for saving intervals.每隔20个时间步显示一次。 R=0.2; %The radius of dielectric columns,ea=11.4; %The dielectric constant of these columns.Zmax=0.8; %The maximum value for z axis when plotting figures.Colormax=2.8; %The maximum value for colormap when plotting figures.%Some constantsmu0=4*pi*1.0e-7; %Epsilon Zero, if using Gauss Unit, it equals to 1.e0=8.85*1e-12; %Mu Zero, if using Gauss Unit, it equals to 1.c=1/sqrt(mu0*e0); %The light speed.factor=mu0/e0; %The factor between conductivity and permeability. %Permeability=Conductivity*factor, in PML.PML中的匹配条件 a=1;%e-6; %The lattice constant.栅格常数。W=W*(2*pi*c/a); %frequency Dx=a/NMlat; %Delta x.dx1/(一个栅格中的网格数)Dy=Dx; %Delta y.Dt=1/sqrt(1/(Dx*Dx)+1/(Dy*Dy)/c; %Time interval%tic%In the following partm we define the dielectric%constants:,定义FDTD中平面波导与空气的介电常数Ep=ones(NTx-1,NTy-1)*e0; %FDTD总的网格中的介质常数,真空。Ep_cell=ones(NMlat,NMlat)*e0;%每个栅格中的fdtd介电常数,真空。x=-(NMlat-1)/2*Dx:Dx:(NMlat-1)/2*Dx;%先对栅格操作,然后进行repmat,复制并平铺阵列。X,Y=meshgrid(x);%把x方向上的向量拓展为X,Y两个矩阵。X=X;Y=Y;flag=find(sqrt(X.2+Y.2)MLatx*NMlat) right=MLatx*NMlat; end Ep(left:right,j)=e0*ea; j=j-1; end j=(MLaty*NMlat+1)/2; for i=1:cot(angle):(MLatx*NMlat+1)/2+length+(NMlat+1)/2 k=round(i); left=(MLaty*NMlat+1)/2-(NMlat+1)/2-length+i-1; %常数可修改 right=left+length+30; %常数可修改 if(rightMLatx*NMlat) right=MLatx*NMlat; end Ep(left:right,j)=e0*ea; j=j+1; endend%tocif WantToSeeEp=1 x=0:Dx:(NMlat*MLatx-1)*Dx; x=x-(NMlat*MLatx-1)*Dx/2; y=0:Dy:(NMlat*MLaty-1)*Dy; y=y-(NMlat*MLaty-1)*Dy/2; X,Y=meshgrid(x,y); X=X; Y=Y; surf(X,Y,Ep/e0); shading interp; view(0,90); axis(min(x), max(x),min(y), max(y) axis off; disp(Press any key to continue.); pauseend%End of defining the Ep.30度:%This program calculate the waveguide by a photonic crystal.%For two dimension case.%Only for TM case(Ez,Hx,Hy), in this version试验版本.clear;%tic%Initial parameters and other things.W=0.36; %Normalized frequency 就是能带图中的纵坐标,单位为(a/lamda)%The following parameters are control parameters.WaveGuide=1; %If this program is for Wave Guide? If so, please specify 1.IsMovie=0; %If you want to play movie, please use 1.IsFigure=1; %If it will plot the figures? If so, please specify 1.WantToSeeEp=1; %Do you want to see the distrubution of Ep(TE极化,S极化)? If so, please specify 1.%End of defining control parametersMLatx=11; %How many Lattice cell in x direction.栅格MLaty=11; %How many Lattice cell in y direction.NMlat=21; %The gird number in each Lattice Cell. 每个栅格中包含的fdtd网格个数 %SHOULD BE ODD INTEGER!奇数整数个 if mod(NMlat,2)=0 NMlat=NMlat+1;end %Force it to be a odd integer!NTx=MLatx*NMlat+1; %It is the number of the Grid along x axis.总的fdtd网格坐标点(所以要加1)NTy=MLaty*NMlat+1; %It is the number of the Grid along y axis.if WaveGuide=1 Nrow=5; %The row number of coloumns between the PML boundary and the waveguide.(此处定义,现在还不知所措)endNPML=12; %How many PML layers will be used in our computation.PML的层数NTimeSteps=5000; %Total number of Time StepsMeach=20; %Define the interval for plot figures if IsFigure=1. %This also works for saving intervals.每隔20个时间步显示一次。 R=0.2; %The radius of dielectric columns,ea=11.4; %The dielectric constant of these columns.Zmax=0.8; %The maximum value for z axis when plotting figures.Colormax=2.8; %The maximum value for colormap when plotting figures.%Some constantsmu0=4*pi*1.0e-7; %Epsilon Zero, if using Gauss Unit, it equals to 1.e0=8.85*1e-12; %Mu Zero, if using Gauss Unit, it equals to 1.c=1/sqrt(mu0*e0); %The light speed.factor=mu0/e0; %The factor between conductivity and permeability. %Permeability=Conductivity*factor, in PML.PML中的匹配条件 a=1;%e-6; %The lattice constant.栅格常数。W=W*(2*pi*c/a); %frequency Dx=a/NMlat; %Delta x.dx1/(一个栅格中的网格数)Dy=Dx; %Delta y.Dt=1/sqrt(1/(Dx*Dx)+1/(Dy*Dy)/c; %Time interval%tic%In the following partm we define the dielectric%constants:,定义FDTD中平面波导与空气的介电常数Ep=ones(NTx-1,NTy-1)*e0; %FDTD总的网格中的介质常数,真空。Ep_cell=ones(NMlat,NMlat)*e0;%每个栅格中的fdtd介电常数,真空。x=-(NMlat-1)/2*Dx:Dx:(NMlat-1)/2*Dx;%先对栅格操作,然后进行repmat,复制并平铺阵列。X,Y=meshgrid(x);%把x方向上的向量拓展为X,Y两个矩阵。X=X;Y=Y;flag=find(sqrt(X.2+Y.2)MLatx*NMlat) right=MLatx*NMlat; end Ep(left:right,j)=e0*ea; j=j-1; end j=(MLaty*NMlat+1)/2; for i=1:cot(angle):(MLatx*NMlat+1)/2+length+(NMlat+1)/2 k=round(i); left=(MLaty*NMlat+1)/2-(NMlat+1)/2-length+i-1; %常数可修改 right=left+length+20; %常数可修改 if(rightMLatx*NMlat) right=MLatx*NMlat; end Ep(left:right,j)=e0*ea; j=j+1; endend%tocif WantToSeeEp=1 x=0:Dx:(NMlat*MLatx-1)*Dx; x=x-(NMlat*MLatx-1)*Dx/2; y=0:Dy:(NMlat*MLaty-1)*Dy; y=y-(NMlat*MLaty-1)*Dy/2; X,Y=meshgrid(x,y); X=X; Y=Y; surf(X,Y,Ep/e0); shading interp; view(0,90); axis(min(x), max(x),min(y), max(y) axis off; disp(Press any key to continue.); pauseend%End of defining the Ep.80度:%This program calculate the waveguide by a photonic crystal.%For two dimension case.%Only for TM case(Ez,Hx,Hy), in this version试验版本.clear;%tic%Initial parameters and other things.W=0.36; %Normalized frequency 就是能带图中的纵坐标,单位为(a/lamda)%The following parameters are control parameters.WaveGuide=1; %If this program is for Wave Guide? If so, please specify 1.IsMovie=0; %If you want to play movie, please use 1.IsFigure=1; %If it will plot the figures? If so, please specify 1.WantToSeeEp=1; %Do you want to see the distrubution of Ep(TE极化,S极化)? If so, please specify 1.%End of defining control parametersMLatx=11; %How many Lattice cell in x direction.光子晶体栅格MLaty=11; %How many Lattice cell in y direction.NMlat=21; %The gird number in each Lattice Cell. 每个栅格中包含的fdtd网格个数 %SHOULD BE ODD INTEGER!奇数整数个,目的就是为了将光子晶体的原点定位在网格中心if mod(NMlat,2)=0 NMlat=NMlat+1;end %Force it to be a odd integer!NTx=MLatx*NMlat+1; %It is the number of the Grid along x axis.总的fdtd网格坐标点NTy=MLaty*NMlat+1; %It is the number of the Grid along y axis.if WaveGuide=1 Nrow=5; %The row number of coloumns between the PML boundary and the waveguide.(此处定义,现在还不知所措)endNPML=12; %How many PML layers will be used in our computation.PML的层数NTimeSteps=4000; %Total number of Time StepsMeach=20; %Define the interval for plot figures if IsFigure=1. %This also works for saving intervals.每隔20个时间步显示一次。 R=0.2; %The radius of dielectric columns,光子晶体的半径,可调ea=11.4; %The dielectric constant of these columns.Zmax=0.6; %The maximum value for z axis when plotting figures.Colormax=1.6; %The maximum value for colormap when plotting figures.%Some constantsmu0=4*pi*1.0e-7; %Epsilon Zero, if using Gauss Unit, it equals to 1.e0=8.85*1e-12; %Mu Zero, if using Gauss Unit, it equals to 1.c=1/sqrt(mu0*e0); %The light speed.factor=mu0/e0; %The factor between conductivity

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论