登 录
註 冊
论坛
微波仿真网
注册
登录论坛可查看更多信息
微波仿真论坛
>
程序
>
Susan C. Hagness的1D/2D/3D FDTD(matlab)源码
发帖
回复
1
2
3
4
5
6
...28
下一页
到第
页
确认
88779
阅读
277
回复
[
资料共享
]
Susan C. Hagness的1D/2D/3D FDTD(matlab)源码
离线
gwzhao
方恨少
UID :17098
注册:
2008-08-24
登录:
2019-01-09
发帖:
1374
等级:
荣誉管理员
0楼
发表于: 2008-10-23 14:40:30
— 本帖被 tensor 从 资料库 移动到本区(2009-10-28) —
[post]%***********************************************************************
r{mj[N'@
% 1-D FDTD code with simple radiation boundary conditions
FHOF6}if
%***********************************************************************
4>R)2g
%
#EG$HX]
% Program author: Susan C. Hagness
wa1Qt
% Department of Electrical and Computer Engineering
1Y+g^Z;G
% University of Wisconsin-Madison
yor6h@F1
% 1415 Engineering Drive
9u0<$UY%
% Madison, WI 53706-1691
Ie"eqO!
% 608-265-5739
4(nwi[1Y
%
hagness@engr.wisc.edu
,::f? Gc7j
%
2r^G;,{
% Date of this version: February 2000
;X;q8J^_K_
%
"rVf{
% This MATLAB M-file implements the finite-difference time-domain
X:2)C-l?
% solution of Maxwell's curl equations over a one-dimensional space
h[(.
% lattice comprised of uniform grid cells.
jCp^CNbA
%
;)Fc@OXN>
% To illustrate the algorithm, a sinusoidal wave (1GHz) propagating
2]:Z7Ji
% in a nonpermeable lossy medium (epsr=1.0, sigma=5.0e-3 S/m) is
SPu+t3
% modeled. The simplified finite difference system for nonpermeable
'f_[(o+n
% media (discussed in Section 3.6.6 of the text) is implemented.
%n B}Hq ;
%
1[:tiTG|C
% The grid resolution (dx = 1.5 cm) is chosen to provide 20
)`5=6i
% samples per wavelength. The Courant factor S=c*dt/dx is set to
_jWGwO
% the stability limit: S=1. In 1-D, this is the "magic time step."
i K,^|Q8
%
)=TS)C4
% The computational domain is truncated using the simplest radiation
+?9. &<?
% boundary condition for wave propagation in free space:
WJU[+|J
%
{ovW6#
% Ez(imax,n+1) = Ez(imax-1,n)
qbx}9pp}g
%
/0 2-0mNv
% To execute this M-file, type "fdtd1D" at the MATLAB prompt.
A<p6]#t#X)
% This M-file displays the FDTD-computed Ez and Hy fields at every
Q@(tyW+8U@
% time step, and records those frames in a movie matrix, M, which is
XlJA}^e
% played at the end of the simulation using the "movie" command.
+bdjZD3
%
Eg+z(m$M
%***********************************************************************
~{cG"
1fMl8[!JLu
clear
^~`t q+
01w}8a(
%***********************************************************************
S; Fj9\2)I
% Fundamental constants
Mwtd<7<!A
%***********************************************************************
V:'_m'.-Y
>(He,o@M
cc=2.99792458e8; %speed of light in free space
wl5+VC*l0
muz=4.0*pi*1.0e-7; %permeability of free space
tRYi q
epsz=1.0/(cc*cc*muz); %permittivity of free space
+'V ,z
~O8Xj6
freq=1.0e+9; %frequency of source excitation
Lq#$q>!K
lambda=cc/freq; %wavelength of source excitation
3)*Twqt
omega=2.0*pi*freq;
]k)h<)nY
,Pj UlcO_
%***********************************************************************
jI!WE$dt
% Grid parameters
6 K-jje;)
%***********************************************************************
UFPSQ
R>B4v+b
ie=200; %number of grid cells in x-direction
ZTzh[2u*
w%?6s 3
ib=ie+1;
ana?;NvC
@)x8<
dx=lambda/20.0; %space increment of 1-D lattice
z8JdA%YBM
dt=dx/cc; %time step
)-\[A<(
omegadt=omega*dt;
?#gYu%7DN
_FxQl]@
nmax=round(12.0e-9/dt); %total number of time steps
!SAR/sdXf
G[lNgVbU@
%***********************************************************************
l*-$H$
% Material parameters
M32Z3<
%***********************************************************************
v=J[p;H^H
%Z-B{I(
eps=1.0;
,M0#?j>
sig=5.0e-3;
WUK{st.z
}J+\o~
%***********************************************************************
e)#f`wM
% Updating coefficients for space region with nonpermeable media
OM (D@up
%***********************************************************************
el3lR((H
-p*j9 z
scfact=dt/muz/dx;
D<J,3(Yu
$.KDnl^
ca=(1.0-(dt*sig)/(2.0*epsz*eps))/(1.0+(dt*sig)/(2.0*epsz*eps));
dkAY%z two
cb=scfact*(dt/epsz/eps/dx)/(1.0+(dt*sig)/(2.0*epsz*eps));
k:DAko}
GF17oMi
%***********************************************************************
?TMrnR/d
% Field arrays
Al^h^ 9tJ
%***********************************************************************
&Xp