登 录
註 冊
论坛
微波仿真网
注册
登录论坛可查看更多信息
微波仿真论坛
>
时域有限差分法 FDTD
>
2D_Y型光波导形成图像问题(MATLAB程序)
发帖
回复
1543
阅读
2
回复
[
求助
]
2D_Y型光波导形成图像问题(MATLAB程序)
离线
410886308
UID :29143
注册:
2009-04-04
登录:
2009-05-02
发帖:
2
等级:
仿真新人
0楼
发表于: 2009-05-02 09:07:41
大家帮我看下这段程序 为什么会形成不规则的Y型 有什么地方需要修改吗
3 M10fI?
%tic
pD2<fP_
%Initial(原始的) parameters and other things.
;k86"W
W=0.36; %Normalized(规范的) frequency
z%7SrUj2
%The following parameters are control parameters.
Gqcz<=/
WaveGuide=1; %If this program is for Wave Guide? If so, please specify 1.
d90Z,nex
IsMovie=0; %If you want to play movie, please use 1.
iy\nio`
IsFigure=1; %If it will plot the figures? If so, please specify 1.
P^Q[-e{
WantToSeeEp=1; %Do you want to see the distrubution of Ep? If so, please specify 1.
X _G| hx
%End of defining control parameters
B_l{<
X!},8}~J~
MLatx=11; %11How many Lattice(格子) cell in x direction.
TLf9>= OVh
MLaty=11; %11How many Lattice cell in y direction.
xc:!cA{V
Z,;cCxE
NMlat=21; %21The grid number in each Lattice Cell.
<uk1?Qg
%SHOULD BE ODD INTEGER(奇整数)!!!!
'snn~{hG
if mod(NMlat,2)==0
CGP3qHrXt
NMlat=NMlat+1;
s (LT
end %Force it to be a odd(奇数) integer!
T<joRR
Af5D>/
NTx=MLatx*NMlat+1; %It is the number of the Grid along x axis.
\WrFqm#
NTy=MLaty*NMlat+1; %It is the number of the Grid along y axis.
,j ',x\
).HDru-2
if WaveGuide==1
W85@v2b
Nrow=5; %4位置问题The row number of columns between the PML boundary and the waveguide.
9Sq%s&
end
bo=ZM9
Lru-u:
NPML=12; %12大小就是时间长短问题How many PML layers will be used in our computation.
%tt%`0
3!o4)yJWx
NTimeSteps=2500; %2500Total number of Time Steps
{"H2 :-t<
9 ASb>A2~
Meach=10; %20Define the interval(间隔) for plot figures if IsFigure==1.
OR Wm C!
%This also works for saving intervals.
u@P[Vb
Ei3zBS?J)
R=0.2; %刚好全反射The radius of dielectric columns
]PP:oriWl
ea=11; %11.4The dielectric constant of these columns.
,chf~-d
C#=bW'C
Zmax=0.6; %0.6The maximum value for z axis when plotting figures.
qxMnp}O
Colormax=0.6; %0.6越大越暗The maximum value for colormap when plotting figures.
q*AQq=
xf>z @)e
%Some constants
o{kbc5_
mu0=4*pi*1.0e-7; %Epsilon Zero, if using Gauss Unit, it equals to 1.
L]hXpt
e0=8.85*1e-12; %Mu Zero, if using Gauss Unit, it equals to 1.
'[(nmx'yVJ
c=1/sqrt(mu0*e0); %The light speed.
]G}B 0u3
factor=mu0/e0; %The factor between conductivity(导电率) and permeability(浸透性).
0g<K [mPr7
%Permeability=Conductivity*factor, in PML.
+P`(Rf"luu
/n^c>)
a=1;%e-6; % 1 The lattice constant.
s NHSr
W=W*(2*pi*c/a); %frequency
s;YKeE!8
9H]Lpi^OH
Dx=a/NMlat; %Delta x.
F'?I-jtI
Dy=Dx; %Delta y.
^D_/=4rz8
Dt=1/sqrt(1/(Dx*Dx)+1/(Dy*Dy))/c; %Time interval
Q_"\Q/=?Do
PS" .R_"
%tic
uH^PQ
%In the following partm we define the dielectric constants:
YEx)"t8E
Ep=ones(NTx-1,NTy-1)*e0;
(5Tvsw`
Ep_cell=ones(NMlat,NMlat)*e0;
5q<zN
x=-(NMlat-1)/2*Dx:Dx:(NMlat-1)/2*Dx;
JH]K/sC>
[X,Y]=meshgrid(x);
XfzVcap
X=X';
7j i=E";.w
Y=Y';
tAFti+Qb
flag=find(sqrt(X.^2+Y.^2)<R);
Y?r po
Ep_cell(flag)=e0*ea;
hc$@J}`
Ep=repmat(Ep_cell,MLatx,MLaty);
qG9+/u)\
ql&*6KZ"
j#6|V]l
if WaveGuide==1
k)FmDX
eb=1; %The dielectric constant in the waveguide
9kY[j2,+
Ep( 1:(MLatx-Nrow)*NMlat, Nrow*NMlat+1:(Nrow+1)*NMlat)=e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dx:(NMlat*MLatx-1)*Dx;
g#K'6VK{
x=x-(NMlat*MLatx-1)* ..
{sv{847V
]`w}+B'/
未注册仅能浏览
部分内容
,查看
全部内容及附件
请先
登录
或
注册
附件:
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
学习了。。。
共
条评分
发帖
回复