⛄一、获取代码方式
获取代码方式1:
完整代码已上传我的资源:【电磁波】基于matlab二维FDTD方法电磁波传播仿真【含Matlab源码 3866期】
点击上面蓝色字体,直接付费下载,即可。
获取代码方式2:
付费专栏Matlab物理应用(初级版)
备注:
点击上面蓝色字体付费专栏Matlab物理应用(初级版),扫描上面二维码,付费29.9元订阅海神之光博客付费专栏Matlab物理应用(初级版),凭支付凭证,私信博主,可免费获得1份本博客上传CSDN资源代码(有效期为订阅日起,三天内有效);
点击CSDN资源下载链接:1份本博客上传CSDN资源代码
⛄二、部分源代码
clear
%***********************************************************************
% Fundamental constants
%***********************************************************************
cc=2.99792458e8; %speed of light in free space
muz=4.0pi1.0e-7; %permeability of free space
epsz=1.0/(ccccmuz); %permittivity of free space
%***********************************************************************
% Grid parameters
%***********************************************************************
ie=50; %number of grid cells in x-direction
je=24; %number of grid cells in y-direction
ke=10; %number of grid cells in z-direction
ib=ie+1;
jb=je+1;
kb=ke+1;
is=26; %location of z-directed current source
js=13; %location of z-directed current source
kobs=5;
dx=0.002; %space increment of cubic lattice
dt=dx/(2.0*cc); %time step
nmax=500; %total number of time steps
%***********************************************************************
% Differentiated Gaussian pulse excitation
%***********************************************************************
rtau=50.0e-12;
tau=rtau/dt;
ndelay=3tau;
srcconst=-dt3.0e+11;
%***********************************************************************
% Material parameters
%***********************************************************************
eps=1.0;
sig=0.0;
%***********************************************************************
% Updating coefficients
%***********************************************************************
ca=(1.0-(dtsig)/(2.0epszeps))/(1.0+(dtsig)/(2.0epszeps));
cb=(dt/epsz/eps/dx)/(1.0+(dtsig)/(2.0epsz*eps));
da=1.0;
db=dt/muz/dx;
%***********************************************************************
% Field arrays
%***********************************************************************
ex=zeros(ie,jb,kb);
ey=zeros(ib,je,kb);
ez=zeros(ib,jb,ke);
hx=zeros(ib,je,ke);
hy=zeros(ie,jb,ke);
hz=zeros(ie,je,kb);
%***********************************************************************
% Movie initialization
%***********************************************************************
tview(:,:)=ez(:,:,kobs);
sview(:,:)=ez(:,js,:);
subplot(‘position’,[0.15 0.45 0.7 0.45]),pcolor(tview’);
shading flat;
caxis([-1.0 1.0]);
colorbar;
axis image;
title([‘Ez(i,j,k=5), time step = 0’]);
xlabel(‘i coordinate’);
ylabel(‘j coordinate’);
subplot(‘position’,[0.15 0.10 0.7 0.25]),pcolor(sview’);
shading flat;
caxis([-1.0 1.0]);
colorbar;
axis image;
title([‘Ez(i,j=13,k), time step = 0’]);
xlabel(‘i coordinate’);
ylabel(‘k coordinate’);
rect=get(gcf,‘Position’);
rect(1:2)=[0 0];
⛄三、运行结果
⛄四、matlab版本及参考文献
1 matlab版本
2014a
2 参考文献
[1]张鹏,陈国平,王宇. 基于特征线法和特征参数法的管道瞬变流计算[J]. 河海大学学报(自然科学版), 2014, 42(6): 602-607.
3 备注
简介此部分摘自互联网,仅供参考,若侵权,联系删除