clc;
clear all;
close all;
%%确定信号参数
c=1500;
f0=25e3;
fs=125e3;
T=2e-3;
lamda=c./f0;
D=lamda./2;
N=18;
maxdelay=(N-1).*D./c;
Nmaxdelay=round(maxdelay.*fs);
alpha=(-45:0.25:45)*pi./180;
px=(0:N-1).*D;
theta0=40*pi./180;
N_delay0=D.*sin(theta0)./c.*fs;
%%信号模型
t=0:1./fs:T;
sig00=sqrt(2).*cos(2.*pi.*f0.*t);
%%时移信号
for mm=1:N;
sig0(mm,:)=[zeros(1,Nmaxdelay) sig00 zeros(1,Nmaxdelay)];
end
% %% 时域波束形成
len=length(sig0(1,:));
tt=(0:len-1)./fs;
tt1=(Nmaxdelay+1:len-1-Nmaxdelay)./fs;
for mm=1:length(alpha);
for nn=1:N;
tc0=(nn-1).*D.*sin(alpha(mm))./c;
ss(nn,:)=interp1(tt,sig0(nn,:),tt1-tc0);
end
sss(mm,:)=sum(ss,1);
sout(mm)=std(sss(mm,:));
end
figure
plot(alpha.*180./pi,20*log10(sout));
xlabel(‘方位角/度‘);
ylabel(‘波束输出‘);
title(‘时域波束形成‘);
原文地址:https://www.cnblogs.com/kiki--xiunai/p/10804821.html