登 录
註 冊
论坛
微波仿真网
注册
登录论坛可查看更多信息
微波仿真论坛
>
时域有限差分法 FDTD
>
2D_Y型光波导形成图像问题(MATLAB程序)
发帖
回复
1542
阅读
2
回复
[
求助
]
2D_Y型光波导形成图像问题(MATLAB程序)
离线
410886308
UID :29143
注册:
2009-04-04
登录:
2009-05-02
发帖:
2
等级:
仿真新人
0楼
发表于: 2009-05-02 09:07:41
大家帮我看下这段程序 为什么会形成不规则的Y型 有什么地方需要修改吗
;As~TGiT
%tic
Thggas,
%Initial(原始的) parameters and other things.
Igo`\JY
W=0.36; %Normalized(规范的) frequency
%xgP*%Sv2
%The following parameters are control parameters.
{Ydhplg{
WaveGuide=1; %If this program is for Wave Guide? If so, please specify 1.
$JFjR@j
IsMovie=0; %If you want to play movie, please use 1.
c~T{;
IsFigure=1; %If it will plot the figures? If so, please specify 1.
D2ggFxqe
WantToSeeEp=1; %Do you want to see the distrubution of Ep? If so, please specify 1.
v^C\ GDH
%End of defining control parameters
\]x`f3F
~?/7:S
MLatx=11; %11How many Lattice(格子) cell in x direction.
7ZUN;mr
MLaty=11; %11How many Lattice cell in y direction.
ktU:Uq
{\$S585
NMlat=21; %21The grid number in each Lattice Cell.
534pX7dg
%SHOULD BE ODD INTEGER(奇整数)!!!!
4!!|P
if mod(NMlat,2)==0
!@z9n\Yj
NMlat=NMlat+1;
4phCn5
end %Force it to be a odd(奇数) integer!
>{^_]phlb
lU1SN/'zx
NTx=MLatx*NMlat+1; %It is the number of the Grid along x axis.
Z!v,;MW
NTy=MLaty*NMlat+1; %It is the number of the Grid along y axis.
/ 4Q=%n
2zj` H9
if WaveGuide==1
X_PzK'#m
Nrow=5; %4位置问题The row number of columns between the PML boundary and the waveguide.
!&U75FpN}:
end
_c]}m3/
2f(`HSC'
NPML=12; %12大小就是时间长短问题How many PML layers will be used in our computation.
f}c;s
+k=*AQt^8
NTimeSteps=2500; %2500Total number of Time Steps
N<JI^%HBgP
UC&$8^
Meach=10; %20Define the interval(间隔) for plot figures if IsFigure==1.
\9+,ynJH8z
%This also works for saving intervals.
JQ+Mg&&Q
(u?s@/e:`/
R=0.2; %刚好全反射The radius of dielectric columns
r`"_D%kc
ea=11; %11.4The dielectric constant of these columns.
+:Zwo+\kSN
29Uqdo
Zmax=0.6; %0.6The maximum value for z axis when plotting figures.
whI4@#
Colormax=0.6; %0.6越大越暗The maximum value for colormap when plotting figures.
{V[xBL <
|]kiH^Ap
%Some constants
cC8$ oCR?
mu0=4*pi*1.0e-7; %Epsilon Zero, if using Gauss Unit, it equals to 1.
,.Gp_BI
e0=8.85*1e-12; %Mu Zero, if using Gauss Unit, it equals to 1.
}-[l)<F:
c=1/sqrt(mu0*e0); %The light speed.
br\3}
factor=mu0/e0; %The factor between conductivity(导电率) and permeability(浸透性).
RY5e%/bg~U
%Permeability=Conductivity*factor, in PML.
h),;j`PrC
5zS%F: 3
a=1;%e-6; % 1 The lattice constant.
oypLE=H
W=W*(2*pi*c/a); %frequency
~cr iZI/
B} qRz
Dx=a/NMlat; %Delta x.
v8-szW).
Dy=Dx; %Delta y.
],c0nz^%BR
Dt=1/sqrt(1/(Dx*Dx)+1/(Dy*Dy))/c; %Time interval
<(E)M@2
{JWixbA
%tic
}Z <I%GT
%In the following partm we define the dielectric constants:
t_/qd9Jv
Ep=ones(NTx-1,NTy-1)*e0;
mLq0;uGL|
Ep_cell=ones(NMlat,NMlat)*e0;
9^Xndo]y
x=-(NMlat-1)/2*Dx:Dx:(NMlat-1)/2*Dx;
b8a(.}8*
[X,Y]=meshgrid(x);
!MSa -
X=X';
L'y0$
Y=Y';
k2Q[v
flag=find(sqrt(X.^2+Y.^2)<R);
R5sEQ| E
Ep_cell(flag)=e0*ea;
W@}@5,}f>
Ep=repmat(Ep_cell,MLatx,MLaty);
,IiKe_B
1XS~b-St
t(}Y /'
if WaveGuide==1
x.gz sd
eb=1; %The dielectric constant in the waveguide
8z93ETv7`
Ep( 1:(MLatx-Nrow)*NMlat, Nrow*NMlat+1:(Nrow+1)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==1
A7QT4h&6
x=0:Dx:(NMlat*MLatx-1)*Dx;
;$eY#ypx
x=x-(NMlat*MLatx-1)* ..
ufR|V-BWx
IlEU6Rs
未注册仅能浏览
部分内容
,查看
全部内容及附件
请先
登录
或
注册
附件:
123.rar
(2 K) 下载次数:19
共
1
条评分
gwzhao
技术分
+1
有自己的观点(心得经验)+技术分,感谢回贴相助.
2009-05-02
离线
永无止境
UID :30226
注册:
2009-04-18
登录:
2009-12-09
发帖:
14
等级:
仿真新人
1楼
发表于: 2009-05-14 20:04:31
楼主能把具体的问题阐述下吗?谢谢!
共
条评分
离线
stevensj506
UID :51134
注册:
2010-01-14
登录:
2011-03-31
发帖:
41
等级:
仿真新人
2楼
发表于: 2010-11-18 20:49:22
学习了。。。
共
条评分
发帖
回复