close all
clear all
clc
c=1500;
fs=10000;
T = 0.1;
t = 0:1/fs:T;
L=length(t);
f=500;
w=2*pi*f;
k=w/c;
M=11; %阵元个数
Nmid=1; %参考点
d=3;%阵元间距
m=[0:1:M-1];
yi=zeros(M,1);% 返回一个M*1维的零矩阵
zi=zeros(M,1);
xi=m*d;
xi=xi.';
%各阵元坐标
y1=20;
x1=10;z1=10;% 声源位置,y轴指向声源平面
Ric1=sqrt((x1-xi).^2+(y1-yi).^2+(z1-zi).^2);%声源至各阵元的距离M*1维
Rn1=Ric1-Ric1(Nmid);%声源至各阵元与参考阵元的声程差矢量M*1维
s1=cos(w*t);%参考阵元接收到的信号1*L维
snr =20;
Am= 10^(-snr/20);
n1=Am*(randn(M,L)+j*randn(M,L));%各阵元噪声矢量
p1=zeros(M,L);%M*L维
for k1=1:M
p1(k1,:)=Ric1(Nmid)/Ric1(k1)*s1.*exp(-j*w*Rn1(k1)/c); %各阵元经过幅度衰减和相位延迟后接收到的信号,M*L维
end
p=p1+n1;%各阵元接收的声压信号矩阵M*L
R=p*p'/L;%接收数据的自协方差矩阵M*M
% ----------------------------------------------------------
% 扫描范围
step_x=0.1;
step_z=0.1;
y=y1;