当前位置:首页 > 嵌入式 > 嵌入式教程
[导读]FDTD参数选择估计程序

针对二阶精度的时域有限差分程序.

  现可直接调用的源信号是:一个周期的正弦信号,高期脉冲,ricker子波.

  其它信号可手动修改源信号接口,或源生成函数.

  ---------------

  请函数.

  %************************************************************

  % 1. determine maximum possible spatial field discretization.

  % (in order to avoid numerical dispersion).(5 grid points per

  % minimum wavelength are needed to avoid dispersion).

  % 2. find the maximum possible time step using this dx and dz.

  % (in order to avoid numerical instability).

  % Coded by yiling. Email: yiling@email.jlu.edu.cn

  % Date: 2008

  %*************************************************************************+

  clear;

  clc;

  %--------------------------------------------------------------------------

  dx=0.02; % (m)

  dy=0.02; % (m)

  epsilonmax=25; % Epsion. maximum relative dielectric permittivity.

  mumax=1; % Mu. maximum relative magnetic permeability.

  sourcetype='ricker'; % can be 'cont_sine', 'gaussian', 'ricker'.

  freq=100e6; % (Hz)

  amp=1; % amplitude.

  thres=0.02; % threshold to determine maximum frequency in source pulse.(proposed = 0.02).

  %--------------------------------------------------------------------------

  Timewindows=528; % (ns)

  %--------------------------------------------------------------------------

  %*************************************************************************+

  %--------------------------------------------------------------------------

  vlight=0.3;

  epsilonmin=1; % Epsion. minimum relative dielectric permittivity.

  mumin=1; % Mu. minimum relative magnetic permeability.

  %--------------------------------------------------------------------------

  dt=1/(vlight*sqrt(1/dx^2+1/dy^2));

  % minwavelength=vlight/sqrt(epsilinmax);

  %--------------------------------------------------------------------------

  t=0:dt:Timewindows;

  dt=dt*1e-9;

  t=t*1e-9;

  Timewindows=Timewindows*1e-9;

  source=gprmaxso(sourcetype,amp,freq,dt,Timewindows);

  [dxmax,wlmin,fmax] = finddx(epsilonmax,mumax,source,t,thres);

  %--------------------------------------------------------------------------

  disp('----------------------------------------------------------------- ');

  disp(['Maximum frequency contained in source pulse = ',num2str(fmax/1e6),' MHz']);

  disp(['Minimum wavelength in simulation grid = ',num2str(wlmin),' m']);

  disp(['Maximum possible electric/magnetic field discretization (dx,dy) = ',num2str(dxmax),' m']);

  disp(' ');

  %--------------------------------------------------------------------------

  %--------------------------------------------------------------------------

  dtmax = finddt(epsilonmin,mumin,dxmax,dxmax);

  disp(['Maximum possible time step with this discretization = ',num2str(dtmax/1e-9),' ns']);

  disp('----------------------------------------------------------------- ');

  %**************************************************

  子函数1

  function dtmax = finddt(epmin,mumin,dx,dz);

  % finddt.m

  %

  % This function finds the maximum time step that can be used in the 2-D

  % FDTD modeling codes TM_model2d.m and TE_model2d.m, such that they remain

  % numerically stable. Second-order-accurate time and fourth-order-accurate

  % spatial derivatives are assumed (i.e., O(2,4)).

  %

  % Syntax: dtmax = finddt(epmin,mumin,dx,dz)

  %

  % where dtmax = maximum time step for FDTD to be stable

  % epmin = minimum relative dielectric permittivity in grid

  % mumin = minimum relative magnetic permeability in grid

  % dx = spatial discretization in x-direction (m)

  % dz = spatial discretization in z-direction (m)

  %

  % by James Irving

  % July 2005

  % convert relative permittivity and permeability to true values

  mu0 = 1.2566370614e-6;

  ep0 = 8.8541878176e-12;

  epmin = epmin*ep0;

  mumin = mumin*mu0;

  % determine maximum allowable time step for numerical stability

  dtmax = 6/7*sqrt(epmin*mumin/(1/dx^2 + 1/dz^2));

  子函数2

  function [dxmax,wlmin,fmax] = finddx(epmax,mumax,srcpulse,t,thres);

  % finddx.m

  %

  % This function finds the maximum spatial discretization that can be used in the

  % 2-D FDTD modeling codes TM_model2d.m and TE_model2d.m, such that numerical

  % dispersion is avoided. Second-order accurate time and fourth-order-accurate

  % spatial derivatives are assumed (i.e., O(2,4)). Consequently, 5 field points

  % per minimum wavelength are required.

  %

  % Note: The dx value obtained with this program is needed to compute the maximum

  % time step (dt) that can be used to avoid numerical instability. However, the

  % time vector and source pulse are required in this code to determine the highest

  % frequency component in the source pulse. For this program, make sure to use a fine[!--empirenews.page--]

  % temporal discretization for the source pulse, such that no frequency components

  % present in the pulse are aliased.

  %

  % Syntax: [dx,wlmin,fmax] = finddx(epmax,mumax,srcpulse,t,thres)

  %

  % where dxmax = maximum spatial discretization possible (m)

  % wlmin = minimum wavelength in the model (m)

  % fmax = maximum frequency contained in source pulse (Hz)

  % epmax = maximum relative dielectric permittivity in grid

  % mumax = maximum relative magnetic permeability in grid

  % srcpulse = source pulse for FDTD simulation

  % t = associated time vector (s)

  % thres = threshold to determine maximum frequency in source pulse

  % (default = 0.02)

  %

  % by James Irving

  % July 2005

  if nargin==4; thres=0.02; end

  % convert relative permittivity and permeability to true values

  mu0 = 1.2566370614e-6;

  ep0 = 8.8541878176e-12;

  epmax = epmax*ep0;

  mumax = mumax*mu0;

  % compute amplitude spectrum of source pulse and corresponding frequency vector

  n = 2^nextpow2(length(srcpulse));

  W = abs(fftshift(fft(srcpulse,n)));

  W = W./max(W);

  fn = 0.5/(t(2)-t(1));

  df = 2.*fn/n;

  f = -fn:df:fn-df;

  W = W(n/2+1:end);

  f = f(n/2+1:end);

  % determine the maximum allowable spatial disretization

  % (5 grid points per minimum wavelength are needed to avoid dispersion)

  fmax = f(max(find(W>=thres)));

  wlmin = 1/(fmax*sqrt(epmax*mumax));

  dxmax = wlmin/5;

  子函数3

  function [excitation]=gprmaxso(type,amp,freq,dt,total_time);

  % GPRMAXSO Computes the excitation function used in 'GprMax2D/3D'

  % simulators for ground probing radar.

  %

  % [excitation] = gprmaxso('source_type',Amplitude,frequency,Time_step,Time_window)

  % source_type can be 'cont_sine', 'gaussian', 'ricker'

  % Amplitude is the amplitude of the source

  % frequency is the frequency of the source in Hz

  % Time_step is the time step in seconds

  % Time_window is the total simulated time in seconds

  %

  % excitation is a vector which contains the excitation function.

  % If you type plot(excitation) Matlab will plot it.

  % You can use the signal processing capabilities of Matlab

  % to get a Spectrum etc.

  %

  % Copyright: Antonis Giannopoulos, 2002 This file can be distributed freely.

  RAMPD=0.25;

  if(nargin < 5)

  error('GPRMAXSO requires all five arguments ');

  end;

  if(isstr(type)~=1)

  error('First argument should be a source type');

  end;

  if(freq==0)

  error(['Frequency is zero']);

  end;

  iter=total_time/dt;

  time=0;

  if(strcmp(type,'ricker')==1)

  rickth=2.0*pi*pi*freq*freq;

  rickper=1.0/freq;

  ricksc=sqrt(exp(1.0)/(2.0*rickth));

  i=1;

  while(time<=total_time)

  delay=(time-rickper);

  temp=exp(-rickth*delay*delay);

  excitation(i)=ricksc*temp*(-2.0)*rickth*delay;

  time=time+dt;

  i=i+1;

  end;

  end;

  if(strcmp(type,'gaussian')==1)

  rickper=1.0/freq;

  rickth=2.0*pi*pi*freq*freq;

  i=1;

  while(time<=total_time)[!--empirenews.page--]

  delay=(time-rickper);

  excitation(i)=exp((-rickth)*delay*delay);

  time=time+dt;

  i=i+1;

  end;

  end;

  if(strcmp(type,'cont_sine')==1)

  i=1;

  while(time<=total_time)

  ramp=time*RAMPD*freq;

  if(ramp>1.0)

  ramp=1.0;

  end;

  excitation(i)=ramp*sin(2.0*pi*freq*time);

  time=time+dt;

  i=i+1;

  end;

  end;

  if(strcmp(type,'sine')==1)

  i=1;

  while(time<=total_time)

  excitation(i)=sin(2.0*pi*freq*time);

  if(time*freq>1.0)

  excitation(i)=0.0;

  end;

  time=time+dt;

  i=i+1;

  end;

  end;

  excitation=excitation.*amp;

本站声明: 本文章由作者或相关机构授权发布,目的在于传递更多信息,并不代表本站赞同其观点,本站亦不保证或承诺内容真实性等。需要转载请联系该专栏作者,如若文章内容侵犯您的权益,请及时联系本站删除。
换一批
延伸阅读

9月2日消息,不造车的华为或将催生出更大的独角兽公司,随着阿维塔和赛力斯的入局,华为引望愈发显得引人瞩目。

关键字: 阿维塔 塞力斯 华为

加利福尼亚州圣克拉拉县2024年8月30日 /美通社/ -- 数字化转型技术解决方案公司Trianz今天宣布,该公司与Amazon Web Services (AWS)签订了...

关键字: AWS AN BSP 数字化

伦敦2024年8月29日 /美通社/ -- 英国汽车技术公司SODA.Auto推出其旗舰产品SODA V,这是全球首款涵盖汽车工程师从创意到认证的所有需求的工具,可用于创建软件定义汽车。 SODA V工具的开发耗时1.5...

关键字: 汽车 人工智能 智能驱动 BSP

北京2024年8月28日 /美通社/ -- 越来越多用户希望企业业务能7×24不间断运行,同时企业却面临越来越多业务中断的风险,如企业系统复杂性的增加,频繁的功能更新和发布等。如何确保业务连续性,提升韧性,成...

关键字: 亚马逊 解密 控制平面 BSP

8月30日消息,据媒体报道,腾讯和网易近期正在缩减他们对日本游戏市场的投资。

关键字: 腾讯 编码器 CPU

8月28日消息,今天上午,2024中国国际大数据产业博览会开幕式在贵阳举行,华为董事、质量流程IT总裁陶景文发表了演讲。

关键字: 华为 12nm EDA 半导体

8月28日消息,在2024中国国际大数据产业博览会上,华为常务董事、华为云CEO张平安发表演讲称,数字世界的话语权最终是由生态的繁荣决定的。

关键字: 华为 12nm 手机 卫星通信

要点: 有效应对环境变化,经营业绩稳中有升 落实提质增效举措,毛利润率延续升势 战略布局成效显著,战新业务引领增长 以科技创新为引领,提升企业核心竞争力 坚持高质量发展策略,塑强核心竞争优势...

关键字: 通信 BSP 电信运营商 数字经济

北京2024年8月27日 /美通社/ -- 8月21日,由中央广播电视总台与中国电影电视技术学会联合牵头组建的NVI技术创新联盟在BIRTV2024超高清全产业链发展研讨会上宣布正式成立。 活动现场 NVI技术创新联...

关键字: VI 传输协议 音频 BSP

北京2024年8月27日 /美通社/ -- 在8月23日举办的2024年长三角生态绿色一体化发展示范区联合招商会上,软通动力信息技术(集团)股份有限公司(以下简称"软通动力")与长三角投资(上海)有限...

关键字: BSP 信息技术
关闭
关闭