这段代码是用于运行声学模拟的测试案例,使用 BELLHOP3D 软件包来进行射线追踪和传输损失计算。

代码首先设置全局变量 'units' 为 'km',表示距离单位为千米。

然后,代码使用 'makebty' 函数生成水深数据,并使用 'plotbty3d' 函数将水深数据以 3D 图形的形式显示出来。

接下来,代码依次进行以下操作:

  1. 复制文件 'ParaBot.bty' 和 'ParaBot.ati',并分别命名为 'ParaBot_ray.bty' 和 'ParaBot_ray.ati'。
  2. 使用 'bellhop3d' 函数对 'ParaBot_ray' 进行射线追踪计算。
  3. 使用 'plotray3d' 函数将射线追踪结果以 3D 图形的形式显示出来。
  4. 删除 'ParaBot_ray.bty' 和 'ParaBot_ray.ati' 文件。

重复上述步骤,代码使用不同的文件名和参数,分别对 2D 和 3D 声学模型进行模拟,并使用 'plotshd' 函数将传输损失结果以极坐标图的形式显示出来。

最后,代码将 'ParaBot3DGaussian' 的结果保存为 .eps 和 .jpeg 格式的图片文件。

代码主要功能:

  • 生成水深数据
  • 进行射线追踪计算
  • 计算传输损失
  • 生成 3D 和 2D 声学模型
  • 显示模拟结果

代码示例:

% run the ParaBot test case
% p517 computational acoustics

global units
units = 'km';
%%
makebty              % make the bathymetry
figure
plotbty3d ParaBot
shading flat

% ray trace
copyfile( 'ParaBot.bty', 'ParaBot_ray.bty' )   % copy over the bathymetry file
copyfile( 'ParaBot.ati', 'ParaBot_ray.ati' )   % copy over the bathymetry file

bellhop3d ParaBot_ray     % run BELLHOP3D on the wedge3d test case

hold on
plotray3d ParaBot_ray.ray

delete( 'ParaBot_ray.bty' )
delete( 'ParaBot_ray.ati' )

%%
copyfile( 'ParaBot.bty', 'ParaBot2D.bty' )   % copy over the bathymetry file
copyfile( 'ParaBot.ati', 'ParaBot2D.ati' )   % copy over the bathymetry file

bellhop3d ParaBot2D     % run BELLHOP3D on the wedge3d test case

% polar plot of the TL
figure
plotshd( 'ParaBot2D.shd' )
caxisrev( [ 60 100 ] )

delete( 'ParaBot2D.bty' )
delete( 'ParaBot2D.ati' )

%%
% 3d run (GeoHat Cartesian)

copyfile( 'ParaBot.bty', 'ParaBot3DHatCart.bty' )   % copy over the bathymetry file
copyfile( 'ParaBot.ati', 'ParaBot3DHatCart.ati' )   % copy over the bathymetry file

bellhop3d ParaBot3DHatCart     % run BELLHOP3D on the wedge3d test case

% polar plot of the TL
figure
plotshd( 'ParaBot3DHatCart.shd' )
caxisrev( [ 60 100 ] )

delete( 'ParaBot3DHatCart.bty' )
delete( 'ParaBot3DHatCart.ati' )

%%
% 3d run (GeoHat Ray centered)

copyfile( 'ParaBot.bty', 'ParaBot3DHatRaycen.bty' )   % copy over the bathymetry file
copyfile( 'ParaBot.ati', 'ParaBot3DHatRaycen.ati' )   % copy over the bathymetry file

bellhop3d ParaBot3DHatRaycen     % run BELLHOP3D on the wedge3d test case

% polar plot of the TL
figure
plotshd( 'ParaBot3DHatRaycen.shd' )
caxisrev( [ 60 100 ] )

delete( 'ParaBot3DHatRaycen.bty' )
delete( 'ParaBot3DHatRaycen.ati' )


%%
% 3d run (GeoGaussian)

copyfile( 'ParaBot.bty', 'ParaBot3DGaussian.bty' )   % copy over the bathymetry file
copyfile( 'ParaBot.ati', 'ParaBot3DGaussian.ati' )   % copy over the bathymetry file

bellhop3d ParaBot3DGaussian     % run BELLHOP3D on the wedge3d test case

% polar plot of the TL
figure
plotshd( 'ParaBot3DGaussian.shd' )
caxisrev( [ 60 100 ] )

delete( 'ParaBot3DGaussian.bty' )
delete( 'ParaBot3DGaussian.ati' )

delete( 'ParaBot.bty' )
delete( 'ParaBot.ati' )
%print -depsc2 ParaBot3DGaussian
%print -djpeg ParaBot3DGaussian

代码使用了一些常用的 MATLAB 函数,例如 'copyfile'、'delete'、'figure'、'plot' 等,以及 BELLHOP3D 软件包中的函数,例如 'bellhop3d'、'plotshd' 等。

该代码可以帮助你了解如何使用 BELLHOP3D 进行声学模拟,以及如何使用 MATLAB 来处理和显示模拟结果。


原文地址: https://www.cveoy.top/t/topic/pkgp 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录