⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readarrivalsasc.m

📁 水声模型 很不错的东西
💻 M
字号:
function [ amp, delay, SrcAngle, RcvrAngle, NumTopBnc, NumBotBnc, narrmat, nsd, nrd, nr, sd, rd, rr ] ...
    = read_arrivals_asc( ARRFIL, narrmx );

% read_arrivals_asc
% useage:
%[ amp, delay, narrmat, nsd, nrd, nr, sd, rd, rr ] ...
%    = read_arrivals_asc( ARRFIL, narrmx );
%
% Loads the arrival time/amplitude data computed by BELLHOP
% You must set the string ARRFIL specifying the Arrivals File
% narrmx specifies the maximum number of arrivals allowed
% mbp 9/96
%
%Modded by A Duncan

ExpectBounceCounts = 1;  %1 if version of bellhop produces counts of interface bounces for each path, 0 otherwise
if ExpectBounceCounts
    NField = 7;
else
    NField = 4;
end

fid = fopen( ARRFIL, 'r');	% open the file

% read the header info

freq = fscanf( fid, '%f',  1  );
nsd  = fscanf( fid, '%i',  1  );
nrd  = fscanf( fid, '%i',  1  );
nr   = fscanf( fid, '%i',  1  );
sd   = fscanf( fid, '%f', nsd );
rd   = fscanf( fid, '%f', nrd );
rr   = fscanf( fid, '%f', nr  );

% loop to read all the arrival info (delay and amplitude)

amp   = zeros( nr, 100, nrd, nsd );
delay = zeros( nr, 100, nrd, nsd );
narrmat = zeros(nr, nrd, nsd);

for isd = 1:nsd
  for ird = 1:nrd
    for ir = 1:nr
      narr = fscanf( fid, '%i', 1 );	% number of arrivals
      narrmat( ir, ird, isd ) = narr;

      if narr > 0   % do we have any arrivals?
        da = fscanf( fid, '%f', [ NField, narr ] );

          amp(   ir, 1:narr, ird, isd ) = da( 1, : ) .* exp( i * da( 2, : )*pi/180);
          delay( ir, 1:narr, ird, isd ) = da( 3, : );
          SrcAngle(  ir, 1:narr, ird, isd ) = da( 4, : );
          if ExpectBounceCounts
              RcvrAngle( ir, 1:narr, ird, isd ) = da( 5, : );
              NumTopBnc( ir, 1:narr, ird, isd ) = da( 6, : );
              NumBotBnc( ir, 1:narr, ird, isd ) = da( 7, : );
          else
              RcvrAngle = [];
              NumTopBnc = [];
              NumBotBnc = [];
          end
      end
    end		% next receiver range
  end		% next receiver depth
end	% next source depth

fclose( fid );

%amp   = amp(   :, 1:narrmx, :, : );
%delay = delay( :, 1:narrmx, :, : );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -