首页 环形光波导耦合器件程序.doc

环形光波导耦合器件程序.doc

举报
开通vip

环形光波导耦合器件程序.doc环形光波导耦合器件程序.doc 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...

环形光波导耦合器件程序.doc
环形光波导耦合器件程序.doc 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 parameters MLatx=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.(此 处定义,现在还不知所措) end NPML=12; %How many PML layers will be used in our computation.PML的层数 NTimeSteps=5000; %Total number of Time Steps Meach=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 constants mu0=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.dx,1/(一个栅格中的网格数) 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(right>MLatx*NMlat) right=MLatx*NMlat; end Ep(left:right,j)=e0*ea; j=j+1; end end %toc if 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...'); pause end %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 parameters MLatx=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.(此 处定义,现在还不知所措) end NPML=12; %How many PML layers will be used in our computation.PML的层数 NTimeSteps=5000; %Total number of Time Steps Meach=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 constants mu0=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.dx,1/(一个栅格中的网格数) 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(right>MLatx*NMlat) right=MLatx*NMlat; end Ep(left:right,j)=e0*ea; j=j+1; end end %toc if 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...'); pause end %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 parameters MLatx=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.(此 处定义,现在还不知所措) end NPML=12; %How many PML layers will be used in our computation.PML的层数 NTimeSteps=5000; %Total number of Time Steps Meach=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 constants mu0=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.dx,1/(一个栅格中的网格数) 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(right>MLatx*NMlat) right=MLatx*NMlat; end Ep(left:right,j)=e0*ea; j=j+1; end end %toc if 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...'); pause end %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 parameters MLatx=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.(此 处定义,现在还不知所措) end NPML=12; %How many PML layers will be used in our computation.PML的层数 NTimeSteps=5000; %Total number of Time Steps Meach=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 constants mu0=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.dx,1/(一个栅格中的网格数) 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(right>MLatx*NMlat) right=MLatx*NMlat; end Ep(left:right,j)=e0*ea; j=j+1; end end %toc if 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...'); pause end %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 parameters MLatx=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.(此 处定义,现在还不知所措) end NPML=12; %How many PML layers will be used in our computation.PML的层数 NTimeSteps=4000; %Total number of Time Steps Meach=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 constants mu0=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.dx,1/(一个栅格中的网格数),此程序是先给光子晶体的数目,再给 fdtd网格分辨率。 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)
本文档为【环形光波导耦合器件程序.doc】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_721103
暂无简介~
格式:doc
大小:60KB
软件:Word
页数:0
分类:生活休闲
上传时间:2017-11-17
浏览量:13