xindao2.m

来自「水声信道传输特性进行仿真的程序」· M 代码 · 共 43 行

M
43
字号
function [hp0,hvx0,hvy0]=xindao2(Data_path,fs) 
%计算海洋声信道冲激响应hl,Vx,Vy;  
%输入变量:海洋声信道参数pi;
T_max=0;
k=1;      %特性阻抗;

   fid1=fopen(Data_path,'r');
   x = fscanf(fid1,'%f');
   status = fclose(fid1);
   line=size(x,1)/12;
   x1=x;
   x1=(reshape(x1,12,line))';
   A=zeros(1,line);
   t=zeros(1,line);
   Theta_In=zeros(1,line);
   j=0;
for i=1:1:line    
    A(i)=x1(i,10);   %幅度
    t(i)=x1(i,12);   %时延
    Theta_In(i)=-x1(i,6);    %掠射角
end
 [T_max,t_n] = max(t);

 hp0=zeros(1,round(T_max*fs)+1);
 hvx0=zeros(1,round(T_max*fs)+1);
 hvy0=zeros(1,round(T_max*fs)+1);
 [t_1,t_n1] =size(t);
 for i=1:1:t_n1                        %计算海洋信道冲激相应;
    hp0(1,round(t(i)*fs+1))=hp0(round(t(i)*fs)+1)+A(i);
    hvx0(1,round(t(i)*fs+1))=hvx0(round(t(i)*fs)+1)+k*A(i)*cos(Theta_In(i));
    hvy0(1,round(t(i)*fs+1))=hvy0(round(t(i)*fs)+1)+k*A(i)*sin(Theta_In(i));
end










⌨️ 快捷键说明

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