⛄一、获取代码方式
获取代码方式1:
完整代码已上传我的资源:【电磁波】 基于matlab 一维FDTD方法电磁波传播仿真【含Matlab源码 3868期】
点击上面蓝色字体,直接付费下载,即可。
获取代码方式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
freq=1.0e+9; %frequency of source excitation
lambda=cc/freq; %wavelength of source excitation
omega=2.0pifreq;
%***********************************************************************
% Grid parameters
%***********************************************************************
ie=200; %number of grid cells in x-direction
ib=ie+1;
dx=lambda/20.0; %space increment of 1-D lattice
dt=dx/cc; %time step
omegadt=omega*dt;
nmax=round(12.0e-9/dt); %total number of time steps
%***********************************************************************
% Material parameters
%***********************************************************************
eps=1.0;
sig=5.0e-3;
%***********************************************************************
% Updating coefficients for space region with nonpermeable media
%***********************************************************************
scfact=dt/muz/dx;
ca=(1.0-(dtsig)/(2.0epszeps))/(1.0+(dtsig)/(2.0epszeps));
cb=scfact*(dt/epsz/eps/dx)/(1.0+(dtsig)/(2.0epsz*eps));
%***********************************************************************
% Field arrays
%***********************************************************************
ez(1:ib)=0.0;
hy(1:ie)=0.0;
%***********************************************************************
% Movie initialization
%***********************************************************************
x=linspace(dx,ie*dx,ie);
subplot(2,1,1),plot(x,ez(1:ie)/scfact,‘r’),axis([0 3 -1 1]);
ylabel(‘EZ’);
subplot(2,1,2),plot(x,hy,‘b’),axis([0 3 -3.0e-3 3.0e-3]);
xlabel(‘x (meters)’);ylabel(‘HY’);
rect=get(gcf,‘Position’);
rect(1:2)=[0 0];
M=moviein(nmax/2,gcf,rect);
⛄三、运行结果
⛄四、matlab版本及参考文献
1 matlab版本
2014a
2 参考文献
[1]张鹏,陈国平,王宇. 基于特征线法和特征参数法的管道瞬变流计算[J]. 河海大学学报(自然科学版), 2014, 42(6): 602-607.
3 备注
简介此部分摘自互联网,仅供参考,若侵权,联系删除